
String.fromCharCode() Class Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
808
|
ActionScript Language Reference
Description
The concat() method creates a string from a series of values. It is equivalent to using the
concatenation operator (
+) with strings but is sometimes preferred for clarity, as the + oper-
ator can also be used to add numbers. For details on concat(), see Chapter 4.
Usage
Note that concat() does not modify string; it returns a completely new string.
Example
var greeting = "Hello";
excitedGreeting = greeting.concat("!");
trace(greeting); // Displays: "Hello"
trace(excitedGreeting); // Displays: "Hello!"
var x = 4; // Initialize x as an integer
trace(x + 5); // Displays: 9
trace(x.concat(5)); // Fails because x is not a string
trace(String(x).concat(5)); // Displays: "45"
var x = "4"; // Initialize x as a string
trace(x.concat(5)); // Displays: "45"
trace(concat("foo", "fee")); // Fails because concat() must be
// invoked as a method of a string
See Also
“Joining Strings Together” and “The concat() function,” in Chapter 4; “Addition,” in
Chapter 5
String.fromCharCode() Class Method
generate a string from one or more code points
Flash 5
String.fromCharCode(code_point1, code_point2,...code_pointn)
Arguments
code_ point1,...code_ pointn
A series of one or more integers corresponding to Unicode character code
points.
Returns ...