| || |
User Sokol, Spencer (Spencer_Sokol@firstdatabank.com.nospam) posted:
Does anybody know of a StrReplace function? What I'm wanting to do is
replace a substring in a string when the substring is in the string. I've
looked at SetField, but that's a no-go because the source string isn't
delimited in anyway. I know it's gotta be there somewhere, I'm just
apparently not seeing it in the help.
Thanks in advance...
[s p e n c e r-s o k o l]
Software Quality Assurance Analyst
"Pure Rock Fury."
User (MMcNaughton@STSSystems.com.nospam) posted:
The string utility library on the rational site i believe has one, this is
another to give you an idea:
Function searchreplace(searchstring As String, _
findstring As String, replacestring As String) As String
Dim curpos As Long
curpos = 1
curpos = InStr(curpos, searchstring, findstring)
searchstring = Left$(searchstring, curpos - 1) & _
replacestring & Right$(searchstring, Len(searchstring) _
- curpos - Len(findstring) + 1)
Loop Until InStr(searchstring, findstring) = 0
searchreplace = searchstring