Name

escapeString — Perform URL escaping on a string

Usage

URL.escapeString(str)

str : String

Description

Returns a new string in which certain characters in str have been replaced with escape sequences of the form % hh, where hh is two hex digits giving the ASCII code for the value.

Returns invalid if str can’t be converted to a string or contains characters from outside the US-ASCII character set.

Example

URL.escapeString("/foo.cgi?foo=1&bar=2")

returns string "%2Ffoo.cgi%3Ffoo%3D1%26bar%3D2"

Get Learning WML, and WMLScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.