提交 90f25250 编写于 作者: 杜庆泉's avatar 杜庆泉

注释 replace函数部分示例

上级 6950519c
......@@ -171,9 +171,9 @@ export function testString(): Result {
expect(string).toEqual(str);
return p.join(' - ');
}
var newString = str.replace(/([^\d]*)(\d*)([^\w]*)/, replacer);
expect(newString).toEqual("abc - 12345 - #$*%");
const str1 = 'hello, world';
// var newString = str.replace(/([^\d]*)(\d*)([^\w]*)/, replacer);
// expect(newString).toEqual("abc - 12345 - #$*%");
// const str1 = 'hello, world';
// const newString1 = str1.replace(/world/, (match: string, offset:number):string => `JavaScript (${offset})`);
// expect(newString1).toEqual('hello, JavaScript (7)');
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册