FUNCTION:  String.isEmpty

String.isEmpty(string)
 
The String.isEmpty function tests the length of a given string to determine if it is empty and returns a boolean value. If the string has zero length, true is returned. if the string has a length greater than zero, false is returned.
 
Note that you can use the String.length function to find the numeric length of a string.
 
The mandatory string parameter can be any string containing zero or more of any combination of characters (including white spaces). This parameter can also be an empty string.
 
Code for IsEmptyExample.wml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   isEmpty example
   </p>
   <do type="accept">
      <go href="IsEmptyExample.wmls#findisempty()" />
   </do>
</card>

<card id="card2">
<p>
   string = $(strng)
   <br />
   empty = $(result)
</p>
</card>

</wml>

 
Code for IsEmptyExample.wmls
extern function findisempty()
{
   var str = Dialogs.prompt("Enter a string", "");
   var res = String.isEmpty(str);
   WMLBrowser.setVar("strng", str);
   WMLBrowser.setVar("result", res);
   WMLBrowser.go("IsEmptyExample.wml#card2");
};

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information