O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

squeeze — Convert all whitespace within a string to a single space

Usage

String.squeeze(str)

str : String

Description

Returns a new string in which all sequences of whitespace characters in str have been reduced to a single space. Returns invalid if str can’t be converted to a string.

Note that leading and trailing spaces aren’t stripped completely; they’re converted to single spaces. See the trim( ) function.

Examples

String.squeeze("foo")

returns string "foo"

String.squeeze(" Once upon a time ")

returns string " Once upon a time"

String.squeeze(invalid)

returns invalid

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required