[AccessD] Replace Function

Gustav Brock gustav at cactus.dk
Tue Oct 21 08:42:40 CDT 2003


Hi Oleg

This is just about the slowest implementation available.
If you need speed have a look here:

  http://www.xbeat.net/vbspeed/c_Replace.htm

Replace5 is a decent compromise between complexity and speed:

  http://www.xbeat.net/vbspeed/c_Replace.htm#Replace05

/gustav


> thanks Jim. I alredy found it --

> Public Function Replace(ByRef strText As String, strSearch As String,
> strReplace As String) As String
> Dim lngStrPos As Long

> lngStrPos = InStr(1, strText, strSearch)
>     Do While lngStrPos <> 0
>         strText = Left$(strText, lngStrPos - 1) & strReplace &
> Mid$(strText, lngStrPos + 1)
>         lngStrPos = InStr(1, strText, strSearch)
>     Loop
>     Replace = strText
> End Function



More information about the AccessD mailing list