| 4206 | */ |
| 4207 | |
| 4208 | String String::ToUpper(UInt32 flags) const |
| 4209 | { |
| 4210 | if (m_sharedString->size == 0) |
| 4211 | return *this; |
| 4212 | |
| 4213 | if (flags & HandleUtf8) |
| 4214 | { |
| 4215 | String upper; |
| 4216 | upper.Reserve(m_sharedString->size); |
| 4217 | utf8::unchecked::iterator<const char*> it(m_sharedString->string.get()); |
| 4218 | do |
| 4219 | utf8::append(Unicode::GetUppercase(*it), std::back_inserter(upper)); |
| 4220 | while (*++it); |
| 4221 | |
| 4222 | return upper; |
| 4223 | } |
| 4224 | else |
| 4225 | { |
| 4226 | auto str = std::make_shared<SharedString>(m_sharedString->size); |
| 4227 | |
| 4228 | char* ptr = m_sharedString->string.get(); |
| 4229 | char* s = str->string.get(); |
| 4230 | do |
| 4231 | *s++ = Detail::ToUpper(*ptr); |
| 4232 | while (*++ptr); |
| 4233 | |
| 4234 | *s = '\0'; |
| 4235 | |
| 4236 | return String(std::move(str)); |
| 4237 | } |
| 4238 | } |
| 4239 | |
| 4240 | /*! |
| 4241 | * \brief Trims the string |
no test coverage detected