isEmpty()

The strLib.isEmpty()system function checks if a string is empty (has a length of 0). It returns “true” if the string’s length is 0, meaning it contains no characters. Otherwise it returns false.

Syntax

   strLib.isEmpty(
             target 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.

result

It returns “true” if the target string is empty, “false” otherwise.

Example

  function main()
       myStr String; 
       myStr2 String; 
       myChar Char(1);

       sysLib.writeStdout(“Is ‘myStr’ variable empty? “ + strLib.isEmpty(myStr)); 
       sysLib.writeStdout(“Is ‘myStr2’ variable empty? “ + strLib.isEmpty(myStr2)); 
       sysLib.writeStdout(“Is ‘myChar’ variable empty?“ + strLib.isEmpty(myChar));
  end

The output is as follows:

   Is the ‘myStr’ variable empty? true 
   Is the ‘myStr’ variable empty? true
   Is the ‘myChar’ variable empty? false