What is the simplest way to replace quote characters with \" sequence inside string values?
相关问题
- how to split a list into a given number of sub-lis
- Generate string from integer with arbitrary base i
- Replacing more than n consecutive values in Pandas
- Converting a string array to a byte array
- How to convert a string to a byte array which is c
相关文章
- JSP String formatting Truncate
- Selecting only the first few characters in a strin
- Python: print in two columns
- extending c++ string member functions
- Google app engine datastore string encoding proble
- Comparing string and boolean in Expression languag
- How to measure complexity of a string?
- What is the limit in size of a Php variable when s
That'll be the
fn:replace()
function.Unrelated to the concrete question, this is an often recurring requirement in order to prevent malformed HTML when redisplaying user controlled input as a HTML attribute. Normally, you should use
<c:out>
orfn:escapeXml()
for this instead. E.g.It not only takes quotes into account, but also all other XML special characters like
<
,>
,&
, etc.See also:
Use javascript replace (with /g to replace all occurrences)