In project I get data from external API and use it for creating PDF. Unfortunatelly here are some whitespaces that broke pdf template, like U+200B
. I try to fix it
private String repair(String text) {
return text == null ? "" : text.stripLeading().stripTrailing().replaceAll("[^\\S ]", "");
}
but it doesn't help. How to fix this problem? Thanks in advance
I solve with replaceAll("[\p{Cf}]", "")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.