Determines if a string is empty.
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.
<?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.wml
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");
};
Code for IsEmptyExample.wmls