字符串的拓展方法
字符串的拓展方法
includes
判断字符串中是否存在
str.includes(“j”); 返回true,false
startsWith endsWith
“abcde”.startsWith(“a”) 判断a是不是从头开始
“abcde”.startsWith(“b”,1) 判断从第1位开始的是不是b
“car_0”.startsWith(“car_”); 判断是否以_car开始
“abc_car”.endsWith("_car") 判断是否以_car结束
“abc_car”.endsWith(“a
原创
2020-08-13 10:57:57 ·
212 阅读 ·
0 评论