Hos*_*ser -1 java string replace
我正在尝试从包含"matchup"引号中的文本的字符串中删除子字符串.要删除的完整子字符串类似于To get an in-depth statistical preview, click "matchup" at the top of the screen.
我正在尝试做一个
string.replace("To get an in-depth statistical preview, click "matchup" at the top of the screen", "");
Run Code Online (Sandbox Code Playgroud)
用空白代替长句; 但是因为"matchup"在字符串中实际上有引号,所以当我把它作为一个参数传递时,它会吓坏,并认为我有两个单独的字符串,matchup它们之间有一些随机的文本.
对不起,如果这很难理解,我可能做得不好.我也尝试过
...'matchup'.... rather than ..."matchup"...
Run Code Online (Sandbox Code Playgroud)
它似乎不起作用.
你可以\"用来表示"一个字符串
因此
string.replace("To get an in-depth statistical preview, click \"matchup\" at the top of the screen", "")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
179 次 |
| 最近记录: |