有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java从数据库中获取字符串,其中包含\n,改为获取\\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"

共 (1) 个答案

  1. # 1 楼答案

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