| 47 | } |
| 48 | |
| 49 | UString to_lower(const UStringView str) |
| 50 | { |
| 51 | /* Only change the case on ascii range characters (codepoint <=0x7f) |
| 52 | * As we know the top bit is set for any bytes outside this range no matter the position in the |
| 53 | * utf8 stream, we can cheat a bit here */ |
| 54 | auto lower_string = UString(str); |
| 55 | for (size_t i = 0; i < lower_string.length(); i++) |
| 56 | { |
| 57 | if ((lower_string[i] & 0b10000000) == 0) |
| 58 | lower_string[i] = tolower(lower_string[i]); |
| 59 | } |
| 60 | return lower_string; |
| 61 | } |
| 62 | |
| 63 | bool ends_with(const UStringView str, const UStringView ending) |
| 64 | { |
no outgoing calls