Rexx - compare String


Advertisements

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.

Syntax

compare(string1,string2) 

Parameters

  • string1 − The source string.

  • string2 − the string to compare against.

Return Value

Returns "0" if "string1" and "string2" are identical otherwise, returns the position of the first character that does not match.

Example

/* Main program */ 
a = "Hello World" 
b = "HELLO World" 
say compare(a,b)

When we run the above program, we will get the following result.

Output

2 
rexx_strings.htm
Advertisements