MCPcopy Index your code
hub / github.com/processing/processing / writeEntryCSV

Method writeEntryCSV

core/src/processing/data/Table.java:1296–1331  ·  view source on GitHub ↗
(PrintWriter writer, String entry)

Source from the content-addressed store, hash-verified

1294
1295
1296 protected void writeEntryCSV(PrintWriter writer, String entry) {
1297 if (entry != null) {
1298 if (entry.indexOf('\"') != -1) { // convert quotes to double quotes
1299 char[] c = entry.toCharArray();
1300 writer.print('\"');
1301 for (int i = 0; i < c.length; i++) {
1302 if (c[i] == '\"') {
1303 writer.print("\"\"");
1304 } else {
1305 writer.print(c[i]);
1306 }
1307 }
1308 writer.print('\"');
1309
1310 // add quotes if commas or CR/LF are in the entry
1311 } else if (entry.indexOf(',') != -1 ||
1312 entry.indexOf('\n') != -1 ||
1313 entry.indexOf('\r') != -1) {
1314 writer.print('\"');
1315 writer.print(entry);
1316 writer.print('\"');
1317
1318
1319 // add quotes if leading or trailing space
1320 } else if ((entry.length() > 0) &&
1321 (entry.charAt(0) == ' ' ||
1322 entry.charAt(entry.length() - 1) == ' ')) {
1323 writer.print('\"');
1324 writer.print(entry);
1325 writer.print('\"');
1326
1327 } else {
1328 writer.print(entry);
1329 }
1330 }
1331 }
1332
1333
1334 protected void writeHTML(PrintWriter writer) {

Callers 1

writeCSVMethod · 0.95

Calls 1

printMethod · 0.65

Tested by

no test coverage detected