I have RTRIM; how to make LTRIM with regexp
问题 I have RTRIM; how to make LTRIM one? public static function rtrim(string:String):String { return string.replace(/\s+$/,""); } 回答1: Wow, seriously? You're using regular expressions to remove a constant sequence of characters from the ends of a string? Really? I don't know Actionscript/Flex, but this isn't the way to go. After a quick google I found a solution which may or may not be more efficient. 回答2: public static function ltrim(string:String):String { return string.replace(/^\s+/,""); }