JSTL function to replace quote chars inside a string?

前端 未结 2 1516
别那么骄傲
别那么骄傲 2020-12-20 14:50

What is the simplest way to replace quote characters with \\\" sequence inside string values?

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 15:05

    Use javascript replace (with /g to replace all occurrences)

    string.replace(/"/g, '\\"')
    

提交回复
热议问题