js
来源:互联网 发布:plc触摸屏编程实例 编辑:程序博客网 时间:2024/05/22 16:49
1.js正则表达式多个匹配项,通过这种方式最方便。
var text = "hello1-hello2-hello3";
var regG = /(he(ll)o\d)\-?/g;// skip hello1
regG.lastIndex = 5;
var globalResult = null;
while ((globalResult = regG.exec(text)) != null) {
console.log("=============")
console.log(globalResult[0]); //支持分组
console.log(globalResult[1]);
console.log(globalResult[2]);
//每一次lastIndex都会变化
console.log("last index is " + globalResult["index"]);
}
/abc/g.source => abc,
/abc/g.flags => g //ecmascript 6
2.对于非BMP(Basic multiligual plane)的字符,可以使用如下方法
"\u12345".codePointAt(0)获得其code point,该值大与0xFFFF,
String.fromCodePoint(104371)
0 0
- js
- js
- JS
- JS
- JS
- js
- js
- js
- js
- js
- JS
- js
- JS
- js
- js
- js
- js
- JS
- eclipse中run cofigurations 里面 Arguments 的两种参数详解
- 动画弹出式按钮OXExpandingButtonBar
- js动态添加行和列
- FireBug的基本使用
- 通过Annotation实现对程序的运行状态监听,简单实现
- js
- N种方法使用C++调用C#.NET库
- Android开发笔记(十三)视图绘制的几个方法
- Oracle 热备份
- 数据存储笔记
- iOS7 打开http使用方法
- ZZULI Oj--1819
- 对于一类离散的概率DP问题的总结(第一次)
- FlexPaper+OpenOffice实现web的在线文档预览功能