Introduction

Strings are the fundamental textual element of the ActionScript language. You should use strings for any data in your application that uses characters for any reason. For example:

myString = "this is a string"; myString = 'this is also a string'; myString = "strings can contain characters such as -(*+5~";

String values must always be enclosed within quotes. You can use either single or double quotes, but the starting and ending quotes enclosing a string must be of the same type.

// Both of these strings cause errors because of mismatched quotes. myString = "an incorrect string';        // Ending quote should be double myString = 'another incorrect string";   // Ending quote should be single

ActionScript provides functionality that allows you to work with strings in many ways. Although ActionScript does not provide native support for regular expressions (pattern matching), the third-party RegExp class described in Recipe 9.6 does.



ActionScript Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2005
Pages: 425

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net