REPLACES THE STRING S1 BY S2 IN THE SYSTEM OBJECT NUMBER N, FROM THE POSITION P, AND RETURNS THE POSITION OF THE LAST CHARACTER OF THE REPLACED STRING
ACTION
The function REPLACE((S1$,S2$,N,P) replaces the string S1$ by S2$ in the source of system object number N, from the position P, selects the string S2$ and returns the position of the last character of the replaced string, or -1 if string S1$ is not found.
So, it is easy to replace all the occurences of a string by another string in a source, by calling the function REPLACE with the position P from a previous call.
The system object is of type : MEMO, MEMO_RICH, SYNEDIT.
SYNTAX:
Result=REPLACE(S1,S2,N,P)
USE ERROR EXAMPLE
rem create a SYNEDIT
dim pos
synedit 1:height 1,280
item_add 1,"dim a"
item_add 1,"a=12345"
wait 1000
rem replace 2345 by 11 and return position of last character
pos=replace("2345","11",1,pos)
caption 0,"position of last character="+str$(pos)
REPLACE()
REPLACE(S1,S2,N,P)
SEE ALSO
MEMO
MEMO_RICH
SYNEDIT
FIND()