| 33 | } |
| 34 | |
| 35 | UString to_upper(const UStringView str) |
| 36 | { |
| 37 | /* Only change the case on ascii range characters (codepoint <=0x7f) |
| 38 | * As we know the top bit is set for any bytes outside this range no matter the position in the |
| 39 | * utf8 stream, we can cheat a bit here */ |
| 40 | auto upper_string = UString(str); |
| 41 | for (size_t i = 0; i < upper_string.length(); i++) |
| 42 | { |
| 43 | if ((upper_string[i] & 0b10000000) == 0) |
| 44 | upper_string[i] = toupper(upper_string[i]); |
| 45 | } |
| 46 | return upper_string; |
| 47 | } |
| 48 | |
| 49 | UString to_lower(const UStringView str) |
| 50 | { |
no outgoing calls