字符串方法

 
var str='http://www.baidu.com';
    if(str.startsWith('http://www')){
        // 以什么开头
        alert('是网址')
    }
    if(str.endsWith('.com')){
        alert('是com网址')
    }
希望自己写的东西能够对大家有所帮助!谢谢
原文地址:https://www.cnblogs.com/mrxinxin/p/10663454.html