/ Published in: ActionScript 3
This can be useful when you retrieve strings from an XML or script that have whitespaces at the beginning or the end.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function stripBeginEndWhithespace(p_string:String):String { var pattern:RegExp = new RegExp("^[ \t ]+|[ \t ]+$","g"); p_string = p_string.replace(pattern, ""); return p_string; }