Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
String.trim
String.removeAt
String.replaceAt
FUNCTION: String.squeeze
String.squeze
(string)
The
String.squeeze
function removes all extra white spaces out of a given string. All occurrences of consecutive white space characters are reduced down to one white space character. The modified string is returned.
You can use the
String.trim
function to remove all leading and trailing white spaces in a string.
The mandatory
string
parameter can be any string containing one or more of any combination of characters and white spaces.
Code for SqueezeExample.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>
squeeze example
</p>
<do type="accept">
<go href="SqueezeExample.wmls#findsqueeze()" />
</do>
</card>
<card id="card2">
<p>
old string = $(oldstrng)
<br />
new string = $(newstrng)
</p>
</card>
</wml>
Code for SqueezeExample.wmls
extern function findsqueeze()
{
var oldstr = Dialogs.prompt("Enter a string", "");
var newstr =
String.squeeze(oldstr)
;
WMLBrowser.setVar("oldstrng", oldstr);
WMLBrowser.setVar("newstrng", newstr);
WMLBrowser.go("SqueezeExample.wml#card2");
};
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information