MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / ascii

Method ascii

modules/gui/gui/src/backend/text_server/ustring.cpp:2029–2054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2027}
2028
2029CharString String::ascii(bool p_allow_extended) const
2030{
2031 if (!length())
2032 {
2033 return CharString();
2034 }
2035
2036 CharString cs;
2037 cs.resize(size());
2038
2039 for (int i = 0; i < size(); i++)
2040 {
2041 char32_t c = operator[](i);
2042 if ((c <= 0x7f) || (c <= 0xff && p_allow_extended))
2043 {
2044 cs[i] = c;
2045 }
2046 else
2047 {
2048 print_unicode_error("Invalid unicode codepoint " + num_int64(c) + ", cannot represent as ASCII/Latin-1");
2049 cs[i] = 0x20;
2050 }
2051 }
2052
2053 return cs;
2054}
2055
2056String String::utf8(const char* p_utf8, int p_len)
2057{

Callers 7

to_ascii_bufferMethod · 0.80
_name_to_tagMethod · 0.80
_string_to_upperMethod · 0.80
_string_to_lowerMethod · 0.80

Calls 4

CharStringClass · 0.70
lengthFunction · 0.50
sizeFunction · 0.50
resizeMethod · 0.45

Tested by

no test coverage detected