equals()

The strLib.equals() system function is used to compare two strings for equality. It returns “true” if the two strings are equal, false otherwise. The comparison is case-sensitive.

Syntax

   strLib.equals(
             string1 STRING | CHAR | DBCHAR | MBCHAR | UNICODE In, 
             string2 STRING | CHAR | DBCHAR | MBCHAR | UNICODE In)
  returns (result BOOLEAN)
target

Input can be any value that is assignment compatible with any of the above types.

suffix

Input can be any value that is assignment compatible with any of the above types.

result

It returns “true” if the string1is equal to the string2, “false” otherwise.

Example

  function main()
       myString String      = “Customer”;
       strEqual String      = “Customer”;
       myChar Char(8)       = “Customer”;
       charEqual Char(6)    = “Custom”;
       myUni Unicode(8)     = “Customer”;
       uniEqual Unicode(8)  = “Customer”;

       sysLib.writeStdout(“Is ‘Customer’ equal to ‘Customer’? “ + strLib.equal(myString, strEqual)); 
       sysLib.writeStdout(“Is ‘Customer’ equal to ‘Custom’? “ + strLib.equal(myChar, charEqual)); 
       sysLib.writeStdout(“Is ‘Customer’ equal to ‘Customer’? “ + strLib.equal(myUni, uniEqual));
   end

The output is as follows:

   Is ‘Customer’ equal to ‘Customer’? true 
   Is ‘Customer’ equal to ‘Custom’? false 
   Is ‘Customer’ equal to ‘Customer’? true