/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function trimWhitespace($string:String):String { if ($string == null) { return ""; } return $string.replace(/^\s+|\s+$/g, ""); } var myString:String = " Hello World "; trace(trimWhitespace(myString)); // OUTPUT // Hello World