How can one remove whitespace from a string in as3?
I would like to be able to remove all carriage returns, spaces, tabs etc.
The simplest way of removing not only spaces but any char for that matter, is as follows,
//Tested on Flash CS5 and AIR 2.0
//Regular expressions
var spaces:RegExp = / /gi; // match "spaces" in a string
var dashes:RegExp = /-/gi; // match "dashes" in a string
//Sample string with spaces and dashes
var str:String = "Bu s ~ Tim e - 2-50-00";
str = str.replace(spaces, ""); // find and replace "spaces"
str = str.replace(dashes, ":"); // find and replace "dashes"
trace(str); // output: Bus~Time:2:50:00