|
|
|
In Java5 there is a handy String.replaceAll() method.... Thus JsonHierarchicalStreamWriter.writeText can be written simply as
private void writeText(String text, Class clazz) { if (needsQuotes(clazz)) { writer.write("\""); } text = text.replaceAll("\"", "\\\\\""); this.writer.write(text); if (needsQuotes(clazz)) { writer.write("\""); } } This does simply no longer compile on JDK 1.3 ;-)
Fixed in Subversion. Please report if it works for you.
|
|||||||||||||||||||||||||||||||||||||
String test1 = "\"I start with a quote";
String test2 = "I end with a quote\"";
String test3 = " middle \" has quote ";