测试字符串长度(中英文) function strLen(s) { var istrstrstrnLen; str = svalue; nLen = ; for(i=;i<=strlength;i++) { str=strsubstring(ii) str=escape(str); if(strlength>) { nLen = nLen + ; } else { nLen = nLen + ; } } return nLen; } 替换 function Replace(sss) { var len len i; var str str ; str = s; len = strlength; len = slength; if (len > len) return s; for (i=;i<= lenlen+ ; i++) { str = strsubstring(ii+len); if (str == s) { str = strsubstring(i) + s + strsubstring(i+lenlen ); i = ; len = strlength; } } return str; } 查找 function Pos(ss) { var len len iflag; var str str ; str = s; len = strlength; len = slength; if (len== || len==) return ; flag = false; if (len > len) return s; for (i=;i<= lenlen+ ; i++) { str = strsubstring(ii+len); if (str == s) { flag = true; break; } } if (flag) return i; else return ; } |