next up previous contents
Next: unescape Up: Methods Previous: parseInt   Contents


escape

Description

Encodes String objects so they can be read on all computers.


Syntax

escape(expression)


Parameters

expression
The expression to convert into a string and encode in a URL-encoded format


Returns

The escape method returns a new String that contains the contents of expression. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, a space is returned as "%20."

Characters with a value greater than 255 are stored using the %uxxxx format.


Example

//Running the following code gives the result,
//Hello%7B%5BWorld%5D%7D.
escape("Hello{[World]}");




Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.