String
对String类的扩展。only版请使用Como.String.trim('')
trim escapeHTML unescapeHTML removeHTML byteLength delLast toInt toArray left right format toLower toUpper on16 un16
trim
返回去掉字符首尾空格后的
' Hello World!     '.trim();			//返回'Hello World!'
escapeHTML
返回严格转义了任何 HTML 字符的
'<b>test</b>'.escapeHTML();			//返回'&lt;b&gt;test&lt;/b&gt;'
unescapeHTML
与 escapeHTML() 相反
'&lt;b&gt;test&lt;/b&gt;'.unescapeHTML();		//返回 '<b>test</b>'
removeHTML
返回移去HTML标签后的字符
'<b>test</b>'.removeHTML();		//返回'test'
byteLength
计算字符长度,中文为两个长度
'abc你好'.byteLength();		//返回7
delLast
除去最后一个字符
'abc你好'.delLast();		//返回'abc你'
toInt
转换为整型
"111".toInt();		//返回111
"aa11".toInt();		//返回NaN
toArray
转换为数组
"111".toArray();		//返回["111"]
"111".toArray('');		//返回["1", "1", "1"]
"1,1,1".toArray(',');		//返回["1", "1", "1"]
left
取左边多少字符
"test".left(2);			//返回"te"
right
取右边多少字符
"test".right(2);		//返回"st"
format
格式化字符串。简单的模板处理。
"test{0}test{1}".format("A", "B");		//返回"testAtestB"
toLower
转小写
"test".toLower();		//返回"test"
toUpper
转大写
"test".toUpper();		//返回"TEST"
on16
转16进制
"test".on16();		//返回"\u0074\u0065\u0073\u0074"
un16
16转10进制
"\u0074\u0065\u0073\u0074".un16();		//返回"test"