JS - 查找字符串中的某个值,截取其之前。和之后的值

var str = "11:222";    

/*

*   截取 “ :”之前和之后的值  

*/
document.write(str.split(':')[0])    //输出11
document.write(str.split(':')[1])    //输出222

posted @ 2019-08-29 14:15  武卡卡  阅读(7093)  评论(0编辑  收藏  举报