ActionScript 2.0 doesn’t have a trim
function to strip whitespace from the start and end of a string. Here’s a simple function I wrote because I couldn’t find a satisfactory example on Google!
function trim(str:String):String |
The horrible "code_"
prefix hack is there because I don’t think there’s a native way to search an array or object for a key or value in ActionScript.
Update: just found this function at: frogstyle.ch. This one does a similar thing, but strips more characters.
function trim(str:String):String |
Update: as3corelib has a static trim method in com.adobe.utils.StringUtil
.