This article was written by Toby Gramm, webmaster of Techfools.com. In the article is a function which will search through a text string, replacing one substring with another.
SearchAndReplace(expression, find, replacewith)
Ok, sure you could use the VBScript Replace() Function, but try moving your script into VB.
Darn!, No replace funciton in VB. So I use this, and it works great in Access too!
Note: VB6 has the replace() function
s = "Oh no, this string has stuff I don't want, like this"
Response.Write SeachAndReplace(s, "I don't want, ","")
Oh no, this string has stuff like this
'Written by: Toby Gramm '040897 Function SearchAndReplace(s, Str1, Str2) Dim pos s = s & "" 'Fix Null pos = InStr(s, Str1) While pos > 0 s = Mid(s, 1, pos - 1) & Str2 & Mid(s, pos + Len(Str1)) pos = InStr(pos, s, Str1) Wend SearchAndReplace = s End Function
[Visit Techfools.com] [Email Toby Gramm]