首页 > 其他 > 详细

ES6 之 05. Es6新增字符串函数

时间:2020-06-13 12:01:02      阅读:47      评论:0      收藏:0      [点我收藏+]
.startWith()
.endWith()
.includes()
.repeat()

string.startsWith(searchvalue, start)

let str=‘abcdefgh‘
str.startsWith(‘a‘)//true
str.startsWith(‘ab‘)//true
str.startsWith(‘bc‘,1)//true  大小写敏感

str.endsWith("g",7) //true

const str1 = ‘Cats are the best!‘;

console.log(str1.endsWith(‘best‘, 17)); //true

ES6 之 05. Es6新增字符串函数

原文:https://www.cnblogs.com/HKUI/p/13112148.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!