2016-09-22 95 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")