如何用空格替换回车\ n

时间:2017-03-28 15:53:04

标签: postgresql jasper-reports

所以在jasper中我有一个字段,其中有一个变量来格式化字符串,但在webapp中,我从中获取数据将打印回车符,例如" line1 \ nline2 \ nline3 \ nline4& #34;我该如何解决这个问题?

SELECT
  CAST(modulesettings.value::json->'soReportFooter' AS varchar) AS footer_value
FROM modulesetting
WHERE modulesetting.key = 'sales'

然后变量表达式取结尾的引号为
$ F {footer_value} .substring(1,$ F {footer_value} .length() - 1)

1 个答案:

答案 0 :(得分:0)

使用a string function

SELECT
  replace(CAST(modulesettings.value::json->'soReportFooter' AS varchar, '\n', ' ') AS footer_value
FROM modulesetting
WHERE modulesetting.key = 'sales'