MCPcopy Create free account
hub / github.com/Tracktion/choc / percentEncodeURI

Function percentEncodeURI

choc/text/choc_StringUtilities.h:575–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575inline std::string percentEncodeURI (std::string_view text)
576{
577 std::string result;
578 result.reserve (text.length());
579
580 for (auto c : text)
581 {
582 if (std::string_view ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~").find (c) != std::string_view::npos)
583 {
584 result += c;
585 }
586 else
587 {
588 result += '%';
589 result += "0123456789abcdef"[static_cast<uint8_t> (c) >> 4];
590 result += "0123456789abcdef"[static_cast<uint8_t> (c) & 15u];
591 }
592 }
593
594 return result;
595}
596
597
598} // namespace choc::text

Callers 1

testStringUtilitiesFunction · 0.85

Calls 3

findMethod · 0.80
reserveMethod · 0.45
lengthMethod · 0.45

Tested by 1

testStringUtilitiesFunction · 0.68