2016-09-22 92 views
0

Oracle中包含字符串的列包括\n,其返回\\n代替单个\n。有什么办法来获得数据库中的确切字符串?从包含 n的数据库获取字符串,而不是获得\ n

//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" 
+0

听起来像数据中包含的文字串'\ N',即反斜杠后面跟有字母'N',而不是真正的换行符。 –

+0

是的,如果我查询返回字符串\ n为什么列? –

+0

我想在从数据库列读取数据之后按\ n分割字符串。 –

回答

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