MCPcopy Create free account
hub / github.com/IBM/Project_CodeNet / CSV_escape

Function CSV_escape

tools/tokenizer/libtoken.c:1206–1222  ·  view source on GitHub ↗

Escape token for output as CSV string.

Source from the content-addressed store, hash-verified

1204
1205// Escape token for output as CSV string.
1206void CSV_escape(FILE *out, const char *token)
1207{
1208 const char *p;
1209 // start CSV string:
1210 fputc('"', out);
1211 for (p = token; *p; p++) {
1212 if (*p == '\n') { // escape embedded real new lines
1213 fputs("\\n", out);
1214 continue;
1215 }
1216 if (*p == '"')
1217 fputc('"', out);
1218 fputc(*p, out);
1219 }
1220 // end CSV string:
1221 fputc('"', out);
1222}
1223
1224// Escape token for output as JSON string.
1225void JSON_escape(FILE *out, const char *token)

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected