Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 15 Feb 2008 00:12:04 +0100
Thanks for that. It isn't really explainable ...
BTW, it took me nearly ages to see the difference in your code lines! For all those who also look for it: in the first string it is "an annoying bug", in second "a annoying bug" ("an" vs "a").
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
Function MyReplace(Source, Sub, Rep)
; This function replace the bugged ReplaceStr()
n = FindStr(Source, Sub)
If n >= 0
t = LeftStr(Source, n)..Rep..RightStr(Source, StrLen(Source) - StrLen(Sub) - n)
Else
t = Source
EndIf
Return(t)
EndFunction
Function MyReplace(Source, Sub, Rep)
;This function replace the bugged ReplaceStr()
While n<>-1
n = FindStr(Source, Sub)
If n >= 0
t = LeftStr(Source, n)..Rep..RightStr( Source,
StrLen(Source) - StrLen(Sub) - n)
Else
t = Source
EndIf
Source=t
WEnd
Return(t)
EndFunction