js 验证字符串功能实例代码如下所示: //去除空格 function jsTrim(value) { var reg = /^\S$/; if (!value) return ""; if (value.length == 0) return value; else { var lp, rp; lp = 0; rp = value.length - 1; while ((value.charAt(lp) == " " || (value.charCodeAt(lp) < 128 ? (reg.test(value.charAt(lp))