Chapter 6. Using Strings

Introduction

In this chapter

  • Creating and editing strings

  • Combining multiple strings into a single string

  • Converting the case of a string

  • Altering the individual characters in a string

  • Chopping your string up into smaller parts

  • Converting objects to and from strings

A string in Flash can be any piece of textual data from a letter to a word to several paragraphs. Strings might also contain or be exclusively made of numbers and other non‐letter characters such as a phone number. ActionScript 3.0 provides several methods for working with, manipulating, searching, and converting strings. We cover some of the things you can do with strings in this chapter.

Working with string primitives

Most of what we've looked at so far have been string primitives or pieces of text surrounded by quotation marks added directly into the code. But as you learned in Chapter 2, everything in ActionScript 3.0 is an object, including strings. When you type a string like “Hello, world!” you're actually creating an instance of the String class. The String class offers a load of extra functionality beyond the capability to store text.

Converting a string object to a primitive

Should the need arise, you can convert ...

Get ActionScript™ 3.0 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.