Make your own free website on Tripod.com
3.2.12. CHANGESTR(needle, haystack, newneedle )

This function was introduced with the REXX ANSI Standard.  Its
purpose is to replace all occurrences of needle in the string
haystack with newneedle. The function returns the changed string.

If haystack does not contain needle, then the original haystack is
returned.
     
     CHANGESTR(‘a’,’fred’,’c’)                -> ‘fred’
     CHANGESTR(‘’,’’,’x’)                     -> ‘’
     CHANGESTR(‘a’,’abcdef’,’x’)              -> ‘xbcdef’
     CHANGESTR(‘0’,’0’,’1’)                   -> ‘1’
     CHANGESTR(‘a’,’def’,’xyz’)               -> ‘def’
     CHANGESTR(‘a’,’’,’x’)                    -> ‘’
     CHANGESTR(‘’,’def’,’xyz’)                -> ‘def’
     CHANGESTR(‘abc’,’abcdef’,’xyz’)          -> ‘xyzdef’
     CHANGESTR(‘abcdefg’,’abcdef’,’xyz’)      -> ‘abcdef’
     CHANGESTR(‘abc’,’abcdefabccdabcd’,’z’)   -> ‘zdefzcdzd’
     


PREV NEXT