String
1141
Example
The following example creates a string with all lowercase characters and then creates a copy of
that string using
toUpperCase()
:
var lowerCase:String = "lorem ipsum dolor";
var upperCase:String = lowerCase.toUpperCase();
trace("lowerCase: " + lowerCase); // output: lowerCase: lorem ipsum dolor
trace("upperCase: " + upperCase); // output: upperCase: LOREM IPSUM DOLOR
An example is also found in the Strings.fla file in the ActionScript samples folder. The
following list gives typical paths to this folder:
■
Windows:
boot drive
\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript
■
Macintosh:
Macintosh HD
/Applications/Macromedia Flash 8/Samples and Tutorials/
Samples/ActionScript
See also
toLowerCase (String.toLowerCase method)
valueOf (String.valueOf method)
public valueOf() : String
Returns the primitive value of a String instance. This method is designed to convert a String
object into a primitive string value. Because Flash Player automatically calls
valueOf()
when
necessary, you rarely need to explicitly call this method.
Availability:
ActionScript 1.0; Flash Player 5
Returns
String
- The value of the string.
Example
The following example creates a new instance of the String class and then shows that the
valueOf
method returns the
primitive
value, rather than a reference to the new instance.
var str:String = new String("Hello World");
var value:String = str.valueOf();
trace(str instanceof String); // true
trace(value instanceof String); // false
trace(str === value); // false
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...