jeffchannell.com

AS3 trim()

Posted in ActionScript 3
2009-10-27 20:55:22 +0000 UTC

I found this snippet while revisiting some old code, and thought it might help someone else. It's trim() for AS3, and it should work in Flash or Flex.

function trim( s:String ):String
{
	return s.replace( /^([\\s|\\t|\\n]+)?(.*)([\\s|\\t|\\n]+)?$/gm, "$2" );
}