To continue the Extension goodness, here is an uber-handy AS3 class that we built the second we had access to AS3.

VI. AS3 String Utils

With the advent of regex in Actionscript, string methods become easier, and in some cases a lot faster. It also gave us a good exercise in AS3. This class is found in the com.chewtinfoil.utils package.

Oddly, Macromedia released a string utils class around the same time we built this, but we found that not only was there less methods, but they made no use of regex, and basically ported an AS2 version.

We have intended on releasing this one for some time, so without further ado, here it is:
Download this AS3 String Utils!

Please let us know if you find any problems, or have any other ideas for fancy string-abusing methods. See a complete API and example after the jump!

Example

import com.chewtinfoil.utils.StringUtils;
var str:String = "This is some <b>Text</b> that contains <i>HTML Characters</i>.";
var newStr:String = StringUtils.stripTags(str);
trace(newStr);
// This is some Text that contains HTML Characters.

API

All these static methods are documented in the class using ASDoc-style comments.

afterFirst
adterLast
beginsWith
beforeFirst
beforeLast
between
block
capitalize
contains
countof
editDistance
endsWith
hasText
isEmpty
isNumeric
padLeft
padRight
properCase
quote
remove
removeExtraWhiteSpace
reverse
reverseWords
similarity
stripTags
swapCase
trim
trimLeft
trimRight
wordCount
truncate

Props to Ryan for a super utility!