MCPcopy Create free account
hub / github.com/NativeScript/android / escape_regexp_string

Function escape_regexp_string

test-app/runtime/src/main/cpp/ada/ada.cpp:16670–16685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16668} // namespace
16669
16670std::string escape_regexp_string(std::string_view input) {
16671 // Assert: input is an ASCII string.
16672 ADA_ASSERT_TRUE(idna::is_ascii(input));
16673 // Let result be the empty string.
16674 std::string result{};
16675 result.reserve(input.size());
16676 for (const auto& c : input) {
16677 // TODO: Optimize this even further
16678 if (should_escape_regexp_char(c)) {
16679 result.append(std::string("\\") + c);
16680 } else {
16681 result.push_back(c);
16682 }
16683 }
16684 return result;
16685}
16686
16687std::string process_base_url_string(std::string_view input,
16688 url_pattern_init::process_type type) {

Calls 5

is_asciiFunction · 0.85
appendMethod · 0.65
reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected