标签:
function removespace(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } function getLength(str) { var DOUBLEBYTE_CHAR_PATTERN = /[^\x00-\xff]/g; if (str == null) return 0; return str.replace(DOUBLEBYTE_CHAR_PATTERN, "aa").length; }
标签:
原文地址:http://www.cnblogs.com/foggy2330/p/5386047.html