查询字符串是否包含某个字符

 var str='今天星期五';
 console.log(str.indexOf('星期五') !=-1) //true
 console.log(str.search('星期五') !=-1) //true

 

posted @ 2021-01-08 10:04  茗涵  阅读(812)  评论(0编辑  收藏  举报