标签:
1.验证字符串是否以某一子串结尾
function endWith (value,str) { if (str == null || str == "" || value.length == 0 || str.length > value.length) return false; if (value.substring(value.length - str.length) == str) return true; else return false; return true; };
2.验证字符串是否以某一子串开始
function startWith (value,str) { if (str == null || str == "" || value.length == 0 || str.length > value.length) return false; if (value.substr(0, str.length) == str) return true; else return false; return true; };
JS验证字符串是否以某一子串结尾,验证字符串是否以某一子串开始
标签:
原文地址:http://www.cnblogs.com/chenchaochao/p/5514234.html