码 | 产量 |
---|---|
\' | 单引号 |
\" | 双引号 |
\\ | 反斜线 |
\n | 新队 |
\r | 回车 |
\t | 标签 |
\b | 退格 |
\f | 形式饲料 |
myStr
。 第一行您将需要使用转义序列正确插入特殊字符。您还需要按照上面的间距来跟踪,在转义序列或单词之间没有空格。这是写出转义序列的文本。
\第二行
ThirdLine
FirstLinenewline
tab
backslash
SecondLinenewline
ThirdLine
myStr
不应包含任何空格
testString: 'assert(!/ /.test(myStr), "myStr
should not contain any spaces");'
- text: myStr
应包含的字符串FirstLine
, SecondLine
和ThirdLine
(记住区分大小写)
testString: 'assert(/FirstLine/.test(myStr) && /SecondLine/.test(myStr) && /ThirdLine/.test(myStr), "myStr
should contain the strings FirstLine
, SecondLine
and ThirdLine
(remember case sensitivity)");'
- text: FirstLine
后面应跟换行符\n
testString: 'assert(/FirstLine\n/.test(myStr), "FirstLine
should be followed by the newline character \n
");'
- text: myStr
应该包含一个制表字符\t
,它跟在换行符后面
testString: 'assert(/\n\t/.test(myStr), "myStr
should contain a tab character \t
which follows a newline character");'
- text: SecondLine
应该以反斜杠字符\\
开头
testString: 'assert(/\SecondLine/.test(myStr), "SecondLine
should be preceded by the backslash character \\
");'
- text: SecondLine
和ThirdLine
之间应该有换行符
testString: 'assert(/SecondLine\nThirdLine/.test(myStr), "There should be a newline character between SecondLine
and ThirdLine
");'
```