admin管理员组文章数量:1794759
ES6: 字符串处理
UTF-16编码:
- str.codePointAt(index)
- String.fromCodePoint(codepoint);
- normalize()
正则表达式
- 新增u修饰符用来处理UTF-16编码的问题 /&.$/u
- 新增pattern.flags 属性 // ‘ig’
- 新增pattern.sticky 属性及’y’修饰符 // 只从lastIndex处匹配,如果和’g’一起存在则’g’被忽略
- 复制正则表达式 // let pattern = new RegEX(old_pattern, ‘gi’)
字符串处理
- str.includes(sub_string) // true or false
- str.startsWith(sub_string) // true or false
- str.endsWith(sub_string) // true or false
- str.repeat(times); // str * times
- 模板字面量
- 支持多行字符串
- 支持变量 // `hello ${name}`
本文标签: ES6 字符串处理
版权声明:本文标题:ES6: 字符串处理 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1754944095a1708457.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论