FromCharCode Method
Returns a string from some Unicode character values.
String. fromCharCode ([code1 [, code2 [,... [, codeN])
Parameters
String
Required. Is a String object.
Code1,..., codeN
Optional. Is the sequence of Unicode character values to be converted to strings. If no parameter is provided, the result is a null string.
Description
You do not need to create a String object before calling fromCharCode.
In the following example, test contains the string "plain ":
Var test = String. fromCharCode (112,108, 97,105,110 );
Requirements
Version 3
See
CharCodeAt method | String object Method
CharCodeAt Method
Returns an integer representing the Unicode encoding of the characters at the specified position.
StrObj. charCodeAt (index)
Parameters
StrObj
Required. Any String object or text.
Index
Required. Number that counts the characters to be processed from scratch. The valid value is a number ranging from 0 to 1 minus the string length.
Description
The first character in a string is 0, the second character is 1, and so on.
If the specified position does not contain any characters, NaN is returned.
Example
The following example illustrates the usage of the charCodeAt method.
Function charCodeAtTest (n ){
Var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // initialize the variable.
Var n; // declare the variable.
N = str. charCodeAt (n-1); // obtain the Unicode value of the character at the position n.
Return (n); // return this value.
}
Flash
String. fromCharCode
Availability
Flash Player 5.
Usage
String. fromCharCode (c1, c2,... cN)
Parameters
C1, c2... cN indicates the decimal integer of the ascii value.
Return
None.
Description
Returns a string consisting of Characters in the parameter ASCII value.
Example
In this example, a "@" character is inserted in the email address using the fromCharCode method.
Address = "admin" + String. fromCharCode (64) + "jb51.net ";
Trace (address );
// Output: admin@jb51.net