• Post Reply Bookmark Topic Watch Topic
  • New Topic

escaping html characters and a string starting with double quote  RSS feed

 
sony vijay
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1) Would the following method work to replace html characters? Specially, I am confused with the double quotes. I tried replaceAll("\"", """) for this in the below method. I am not sure if this is right.



2) I need to create a string which starts and ends with double quotes (eg: "sony"). So, do I replace " with \" in my string? For some reason this doesn't seem to work.

String sony = "\"sony\""

Thanks,
Sony
 
Campbell Ritchie
Marshal
Posts: 56595
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You won't manage "\"" and """. You would need to escape both the \ and the ", so try "\\\"" and "\""
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!