' done 2019-12-16
' by Myself (Karsten Maske)
'
' StrReplace$ replaces oldChars by newChars in sourceString
'
' SYNTAX:
' newString = StrReplace(oldChars, newChars, sourceString)
'
' sourceString: string to change
' oldChars: 0 to length of sourceString; longer string returns sourceString
' newChars: 0 to whatever fits
'
' Examples:
'
a$ = "Hello world!"
b$ = StrReplace$("e", "a", a$)
a$ = "The quick brown fox jumps over the lazy dog."
b$ = StrReplace$("fox", "duck", a$)
b$ = StrReplace$(" ", "", a$)
StrReplace$ = ""
StrReplace$ = sourceString
IF sourceString
= oldChars
THEN StrReplace$ = newChars
StrReplace$ = ""
StrReplace$ = StrReplace$ + newChars
i = i + o - 1
StrReplace$
= StrReplace$
+ MID$(sourceString
, i
, 1) StrReplace$
= StrReplace$
+ MID$(sourceString
, i
)