将特殊字符插入String变量

时间:2022-09-13 09:15:09

I am new in Java and I am trying to solve this problem:

我是Java新手,我正在尝试解决这个问题:

How to save below highlighted string into a variable ?

如何将突出显示的字符串保存到变量中?

( /[\+]+/.test(elements[i]) ) ? elements[i].replace(\"+\",\"_\") : elements[i];" +

(/[\++++.test(elements[i)))? elements [i] .replace(\“+ \”,\“_ \”):elements [i];“+

Thank you.

1 个解决方案

#1


Not sure what you mean but... "( /[\\+]+/.test(elements[i]) ) ? elements[i].replace(\\\"+\\\",\\\"_\\\") : elements[i];\" +" ?

不确定你的意思,但......“(/ [\\ +] +/.test(elements[i)))?elements [i] .replace(\\\”+ \\\“,\\\” _ \\\“):elements [i]; \”+“?

#1


Not sure what you mean but... "( /[\\+]+/.test(elements[i]) ) ? elements[i].replace(\\\"+\\\",\\\"_\\\") : elements[i];\" +" ?

不确定你的意思,但......“(/ [\\ +] +/.test(elements[i)))?elements [i] .replace(\\\”+ \\\“,\\\” _ \\\“):elements [i]; \”+“?