Rexx – Strings


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.

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *