ScriptBasic

Support => General Discussions => Topic started by: John_M on May 17, 2006, 12:42:53 AM

Title: REPLACE
Post by: John_M on May 17, 2006, 12:42:53 AM
Hello; I am having trouble with REPLACE.
From the user guide:

REPLACE("alabama mama", "a","x",3,5)

will replace only three occurrences of string "a" starting at position 5. The result is "alabxmx mxma".
----------------
Have tried many variations, but have not been able to get it to work?

This should work, yes?

doda="qwhertyuhioplkjhgfdsah"
x="h"
y="m"
REPLACE(doda,x,y)

Where every occurrence of h is replaced with m. Thanks
---------
ok, I found out how to use it.

print REPLACE("alabama mama", "a","x",3,5)

will replace only three occurrences of string "a" starting at position 5.
The result "alabxmx mxma" is printed.
--------------
my example:
doda="qwhertyuhioplkjhgfdsah"
x="h"
y="m"
newdat=REPLACE(doda,x,y)
print REPLACE(doda,x,y)
print newdat

gives:
qwmertyumioplkjmgfdsam
qwmertyumioplkjmgfdsam

I am really glad this works as I need to filter
a few files.
Title: REPLACE
Post by: Support on May 17, 2006, 04:20:49 PM
So I can assume it's working for you and you just needed to talk about it with us? ;-)

John