MCPcopy Create free account
hub / github.com/apache/arrow / Escape

Function Escape

cpp/src/arrow/util/string.cc:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39std::string Escape(const char* data, size_t length) {
40 std::string escaped_string;
41 escaped_string.reserve(length);
42 for (size_t j = 0; j < length; ++j) {
43 switch (data[j]) {
44 case '"':
45 escaped_string += R"(\")";
46 break;
47 case '\\':
48 escaped_string += R"(\\)";
49 break;
50 case '\t':
51 escaped_string += R"(\t)";
52 break;
53 case '\r':
54 escaped_string += R"(\r)";
55 break;
56 case '\n':
57 escaped_string += R"(\n)";
58 break;
59 default:
60 escaped_string.push_back(data[j]);
61 }
62 }
63 return escaped_string;
64}
65
66std::string HexEncode(const char* data, size_t length) {
67 return HexEncode(reinterpret_cast<const uint8_t*>(data), length);

Callers

nothing calls this directly

Calls 4

push_backMethod · 0.80
reserveMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected