Rexx Tutorial on Rexx Strings

strings in rexx are denoted by a sequence of characters. the following program is an example of strings −

/* main program */ 
a = "this is a string" 
say a

the output of the above program is as follows −

this is a string 

let’s discuss some methods which are available in rexx for strings.

sr.no. methods available in rexx for strings
1 left

this method returns a certain number of characters from the left of the string.

2 right

this method returns a certain number of characters from the right of the string.

3 length

this method returns the number of characters in the string.

4 reverse

this method returns the characters in a reverse format.

5 compare

this method compares 2 strings. returns "0" if "string1" and "string2" are identical. otherwise, it returns the position of the first character that does not match.

6 copies

this method copies a string n number of times.

7 substr

this method gets a sub string from a particular string.

8 pos

this method returns the position of one string within another.

9 delstr

this method deletes a sub string from within a string.