I have a problem with strings saved in a database, like this for example: \"311\\315_316\\336_337\"
. They have only one backslash and this is a problem in java. Wh
The data in the database is OK, and you don't have to replace anything. String literals, written directly in the Java code, must have their backslash escaped by another backslash:
String s = "311\\315_316\\336_337";
System.out.println(s); // prints 311\315_316\336_337
But if you get those values from the database, you don't have anything to do:
String s = resultSet.getString(1);
System.out.println(s); // should print 311\315_316\336_337