ofer71 Intermediate
Joined: 12 Feb 2003 Posts: 358 Topics: 4 Location: Israel
|
Posted: Tue Nov 04, 2003 2:38 am Post subject: |
|
|
H?
There is no Built-Ib function in REXX for replace.
I wrote my own function:
Code: |
/* REXX */
A = 'MY NAME IS OFER'
SAY A
B = REPLACE(A,' OFER',' OFERICO')
SAY B
EXIT
REPLACE:
RETSTRING = ARG(1)
ARG2LENGTH = LENGTH(ARG(2))
DO FOREVER
LOOK4_POS = POS(ARG(2),RETSTRING)
IF SUBSTR(RETSTRING,LOOK4_POS+ARG2LENGTH,1) ?= ' ' THEN LEAVE
IF LOOK4_POS = 0 THEN LEAVE
RETSTRING = SUBSTR(RETSTRING,1,LOOK4_POS-1)||,
ARG(3)||,
SUBSTR(RETSTRING,LOOK4_POS+ARG2LENGTH)
END
RETURN RETSTRING
|
Attention: This function is "word sensitive".
HTH
O.
________
vaporizer shop
Last edited by ofer71 on Sat Feb 05, 2011 11:08 am; edited 1 time in total |
|