Return to Snippet

Revision: 39479
at January 18, 2011 02:00 by gandreini


Initial Code
function stripBeginEndWhithespace(p_string:String):String
{
  var pattern:RegExp = new RegExp("^[ \t
]+|[ \t
]+$","g");
  p_string = p_string.replace(pattern, "");
  return p_string;
}

Initial URL

                                

Initial Description
This can be useful when you retrieve strings from an XML or script that have whitespaces at the beginning or the end.

Initial Title
Strip whitespace at the beginning and the end of a string

Initial Tags
regexp

Initial Language
ActionScript 3