MCPcopy Create free account
hub / github.com/InoriRus/Kyty / Simplify

Method Simplify

source/lib/Core/src/String.cpp:1274–1301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1272}
1273
1274String String::Simplify() const
1275{
1276 EXIT_IF(m_data == nullptr);
1277
1278 String r;
1279 uint32_t size = Size();
1280 bool prev_space = true;
1281
1282 for (uint32_t i = 0; i < size; i++)
1283 {
1284 char32_t c = m_data->At(i);
1285 if (Char::IsSpace(c))
1286 {
1287 if (prev_space)
1288 {
1289 continue;
1290 }
1291
1292 prev_space = true;
1293 } else
1294 {
1295 prev_space = false;
1296 }
1297
1298 r += c;
1299 }
1300 return r.TrimRight();
1301}
1302
1303String String::ReplaceChar(char32_t old_char, char32_t new_char, Case cs) const
1304{

Callers 4

test_3Function · 0.45
test_U_3Function · 0.45
test_3Function · 0.45
test_U_3Function · 0.45

Calls 4

SizeClass · 0.85
AtMethod · 0.80
IsSpaceFunction · 0.70
TrimRightMethod · 0.45

Tested by 4

test_3Function · 0.36
test_U_3Function · 0.36
test_3Function · 0.36
test_U_3Function · 0.36