2016-09-22 9 views
0

\nを含む文字列を含むOracleの列は、\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

DB列から読み込んだ後、\ nで文字列を分割します。 –

答えて

1
sample_data.replaceAll("\\\\n", "\\n") 
関連する問題