aspose file tools
The moose likes Java in General and the fly likes escaping html characters and a string starting with double quote Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "escaping html characters and a string starting with double quote" Watch "escaping html characters and a string starting with double quote" New topic
Author

escaping html characters and a string starting with double quote

sony vijay
Ranch Hand

Joined: Jun 27, 2010
Posts: 32
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
Sheriff

Joined: Oct 13, 2005
Posts: 32712
    
    4
You won't manage "\"" and """. You would need to escape both the \ and the ", so try "\\\"" and "\""
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: escaping html characters and a string starting with double quote
 
Similar Threads
How to escape smart quotes in java?
ReplaceAll method in Matcher class - doesn't work for backslash!
Character replacement
Creating a table cell with text containing an apostrophe
a regular expression search and replace program