Revision: 33736
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 12, 2010 22:35 by adrianparr
Initial Code
function removeNonNumericChars($str:String):String { var newStr:String = ""; for (var i:int = 0; i<$str.length; i++) { var currentCharCode:Number = $str.charCodeAt(i); if ((currentCharCode >= 48) && (currentCharCode <= 57)) { newStr += $str.charAt(i); } } return newStr; } var myString:String = "#12abc345^67%89)(-@!foo"; trace("myString: "+myString); myString = removeNonNumericChars(myString); trace("myString: "+myString); // OUTPUT // myString: #12abc345^67%89)(-@!foo // myString: 123456789
Initial URL
Initial Description
Initial Title
AS3 Remove Non-Numeric Characters from a String
Initial Tags
Initial Language
ActionScript 3