| 135 | }); |
| 136 | } |
| 137 | string string::capitalize() { |
| 138 | return apply_transform(*this, [](const std::string & s) { |
| 139 | if (s.empty()) return s; |
| 140 | std::string res = s; |
| 141 | res[0] = ::toupper(static_cast<unsigned char>(res[0])); |
| 142 | std::transform(res.begin() + 1, res.end(), res.begin() + 1, ::tolower); |
| 143 | return res; |
| 144 | }); |
| 145 | } |
| 146 | string string::titlecase() { |
| 147 | return apply_transform(*this, [](const std::string & s) { |
| 148 | std::string res = s; |
no test coverage detected