contentEquals()

The strLib.contentEquals() system function is used to compare the exact content of a string with that of another string, checking for an exact match.

It returns “true” if the entire sequence of characters matches the string, “false” otherwise.

Syntax

  strLib.contentEquals(
             target STRING | CHAR | DBCHAR | MBCHAR | UNICODE In, 
             toCompare 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.

stringToCompare

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

result

It returns “true” if the targetis equal to the stringToCompare, 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.contentEquals(myString, strEqual)); 
       sysLib.writeStdout(“Is ‘Customer’ equal to ‘Custom’? “ + strLib.contentEqual(myChar, charEqual)); 
       sysLib.writeStdout(“Is ‘Customer’ equal to ‘Customer’? “ + strLib.contentEqual(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