FUNCTION:  String.length

The String.length function returns the integer length of a given string. If the string is an empty string, a zero is returned.
Note that you can use the String.isEmpty function to determine if a string is empty (i.e., has zero length).
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 LengthExample.wml
<?xml version="1.0"?>

<card id="card1">
   length example
   <do type="accept">
      <go href="LengthExample.wmls#findlength()" />

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


Code for LengthExample.wmls
extern function findlength()
   var str = Dialogs.prompt("Enter a string", "");
   var len = String.length(str);
   WMLBrowser.setVar("strng", str);
   WMLBrowser.setVar("result", len);

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