MCPcopy Create free account
hub / github.com/LAStools/LAStools / escape_csv_value

Function escape_csv_value

LASzip/src/mydefs.cpp:868–880  ·  view source on GitHub ↗

Correctly encapsulates CSV special characters and doubles quotation marks for valid CSV

Source from the content-addressed store, hash-verified

866
867/// Correctly encapsulates CSV special characters and doubles quotation marks for valid CSV
868std::string escape_csv_value(const std::string& value) {
869 // only escape if special " characters present
870 std::string escaped;
871 escaped.reserve(value.size());
872
873 for (char c : value) {
874 if (c == '"')
875 escaped += "\"\""; // double quotation marks
876 else
877 escaped += c;
878 }
879 return escaped;
880}
881
882/// Converts all XML reserved characters in the string to their safe entity codes for valid XML
883std::string escape_xml_value(const std::string& value) {

Callers 3

operator()Method · 0.85
write_full_csvFunction · 0.85
writeMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected