Merge pull request #15258 from eugenp/ulisseslima-patch-1

BAEL-2499 - Write to CSV in Java
This commit is contained in:
Loredana Crusoveanu 2023-11-21 11:11:22 +02:00 committed by GitHub
commit 4e4fa700ae
1 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,10 @@ public class WriteCsvFileExample {
}
public String escapeSpecialCharacters(String data) {
if (data == null) {
throw new IllegalArgumentException("Input data cannot be null");
}
String escapedData = data.replaceAll("\\R", " ");
if (data.contains(",") || data.contains("\"") || data.contains("'")) {
data = data.replace("\"", "\"\"");