FUNCTION:  String.toString

The String.toString function takes the given value and converts it into a string. The value can be a boolean, fixed-point number, floating-point number, or even a string. The converted value is returned. If the value is invalid, then this function returns invalid.
Once the value is converted, you can use the String.trim function to remove all leading and trailing white space. You can also use the String.squeeze to remove extra white spaces between characters and elements.
The mandatory value parameter can be any combination of zero or more characters (letters, numbers, decimal points, etc.) and white spaces. If the value is an empty string, an empty string is returned.
Code for ToStringExample.wml
<?xml version="1.0"?>

<card id="card1">
   toString example
   <do type="accept">
      <go href="ToStringExample.wmls#findtostring()" />

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


Code for ToStringExample.wmls
extern function findtostring()
   var val = Dialogs.prompt("Enter a value", "");
   var str = String.toString(val);
   WMLBrowser.setVar("strng", str);
   WMLBrowser.setVar("value", val);

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