DekGenius.com
[ Team LiB ] Previous Section Next Section

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.

    [ Team LiB ] Previous Section Next Section