MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / uri_file_decode

Method uri_file_decode

core/string/ustring.cpp:4693–4714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4691}
4692
4693String String::uri_file_decode() const {
4694 CharString src = utf8();
4695 CharString res;
4696 for (int i = 0; i < src.length(); ++i) {
4697 if (src[i] == '%' && i + 2 < src.length()) {
4698 char ord1 = src[i + 1];
4699 if (is_digit(ord1) || is_ascii_upper_case(ord1)) {
4700 char ord2 = src[i + 2];
4701 if (is_digit(ord2) || is_ascii_upper_case(ord2)) {
4702 char bytes[3] = { (char)ord1, (char)ord2, 0 };
4703 res += (char)strtol(bytes, nullptr, 16);
4704 i += 2;
4705 }
4706 } else {
4707 res += src[i];
4708 }
4709 } else {
4710 res += src[i];
4711 }
4712 }
4713 return String::utf8(res);
4714}
4715
4716String String::c_unescape() const {
4717 String escaped = *this;

Callers 9

_parse_buffersMethod · 0.80
_parse_imagesMethod · 0.80
get_file_pathMethod · 0.80
_get_drivesFunction · 0.80
_parse_imageMethod · 0.80
process_eventsMethod · 0.80
test_string.hFile · 0.80

Calls 3

is_digitFunction · 0.85
is_ascii_upper_caseFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected