WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

String Manipulation

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

StrReplaceWild




#DefineFunction StrReplaceWild(Str,Old,New)
i = StrIndexWild(Str,Old,1)
While i
   fl = StrLenWild(Str,Old,i)
   fs = StrSub(Str,i,fl)
   w = StrIndex(Old,"*",1,@FWDSCAN)
   ws = StrSub(fs,w,StrCharCount(fs) - StrCharCount(Old) + 1)
   rs = StrReplace(New,"*",ws)
   rsl = StrCharCount(rs)
   Str = StrCat(StrSub(Str,1,i - 1),rs,StrSub(Str,i + fl,-1))
   i = StrIndexWild(Str,Old,i+rsl)
EndWhile
Return Str
#EndFunction

InStr = StrCat('img src="../gif_css/red.gif" height="10" width="12">',@CRLF,'img src="../gif_css/yellow.gif" height="10" width="12">')
OutStr = StrReplaceWild(InStr,'img src="*" height="10" width="12">','img src="*" alt="" height="10" width="12">')
Message("",StrCat(InStr,@CRLF,@CRLF,OutStr))




Article ID:   W16742
File Created: 2006:11:06:09:12:10
Last Updated: 2006:11:06:09:12:10