escape()
Availability
Flash Player 5.
Usage
escape(expression:String) : String
Parameters
expression The expression to convert into a string and encode in a URL-encoded format.
Returns
URL-encoded string.
Description
Function; converts the parameter to a string and encodes it in a URL-encoded format, where all nonalphanumeric characters are replaced with % hexadecimal sequences. When used in a URL-encoded string, the percentage symbol (%) is used to introduce escape characters, and is not equivalent to the modulo operator (%).
Example
The following code produces the result someuser%40somedomain%2Ecom:
var email:String = “someuser@somedomain.com”;
trace(escape(email));
In this example, the at symbol (@) was replaced with %40 and the dot symbol (.) was replaced with %2E. This is useful if you’re trying to pass information to a remote server and the data has special characters in it (for example, & or ?), as shown in the following code:
var redirectUrl = “http://www.somedomain.com?loggedin=true&username=Gus”;
getURL(“http://www.myothersite.com?returnurl=”+ escape(redirectUrl));
See also
unescape()
related link in Macromedia livedocs
About this entry
You’re currently reading “escape(),” an entry on multiplicité
- Published:
- Friday, August 13th, 2004 at 11:10 pm
- This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Korea.
- Author:
- vizualizer
- Category:
- techne
1 Comment
Jump to comment form | comments rss