Dinesh- Flex/AIR Blog

Archive for October 30th, 2008

Removing whitespace characters from String

without comments

var str:String=”  123456789    “;

Trace(str.length); //15
Trace(StringUtil.trim(str).length); //9

StringUtil.trim method removes all whitespace characters from the beginning and end of the specified string.

The StringUtil utility class has some more methods that will be more useful when you work with String objects within Flex:-)

Written by dineshblog

October 30, 2008 at 1:29 pm

Posted in Flex