don*_*pal 15 apache-flex adobe actionscript-3
我正在尝试从字符串的前端和末尾修剪空白区域.看起来as3没有修剪功能.任何人都知道如何做到这一点?
bug*_*lot 24
您在实用程序类中有一个名为trim的方法,名为StringUtil => http://livedocs.adobe.com/flex/3/langref/mx/utils/StringUtil.html#trim%28%29
看看http://jeffchannell.com/ActionScript-3/as3-trim.html
function trim( s:String ):String
{
return s.replace( /^([\s|\t|\n]+)?(.*)([\s|\t|\n]+)?$/gm, "$2" );
}
Run Code Online (Sandbox Code Playgroud)
http://www.designscripting.com/2008/11/string-utils-in-as3/有大量的字符串实用函数,包括字符串修剪
| 归档时间: |
|
| 查看次数: |
24277 次 |
| 最近记录: |