Suresh Kb
Suresh Kb

Reputation: 151

Getting string from database that includes \n, getting \\n instead

Column in Oracle which contains string including \n, its returning \\n in place of single \n. Is there any way to get the exact string that's in the database?

//getting fileExposure from oracle db
List<FileExposure> fileExposure =dao.find(FileExposure.class,1);

//geting the string sample_data-->"this is a simple data\n for other features\n"
String sample_data=fileExposure.getSampleData();

//it returning "this is a simple data\\n for other features\\n"

Upvotes: 0

Views: 423

Answers (1)

Suresh Kb
Suresh Kb

Reputation: 151

sample_data.replaceAll("\\\\n", "\\n")

Upvotes: 1

Related Questions