MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / get_slicec

Method get_slicec

modules/gui/gui/src/backend/text_server/ustring.cpp:1333–1370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1331}
1332
1333String String::get_slicec(char32_t p_splitter, int p_slice) const
1334{
1335 if (is_empty())
1336 {
1337 return String();
1338 }
1339
1340 if (p_slice < 0)
1341 {
1342 return String();
1343 }
1344
1345 const char32_t* c = this->ptr();
1346 int i = 0;
1347 int prev = 0;
1348 int count = 0;
1349 while (true)
1350 {
1351 if (c[i] == 0 || c[i] == p_splitter)
1352 {
1353 if (p_slice == count)
1354 {
1355 return substr(prev, i - prev);
1356 }
1357 else if (c[i] == 0)
1358 {
1359 return String();
1360 }
1361 else
1362 {
1363 count++;
1364 prev = i + 1;
1365 }
1366 }
1367
1368 i++;
1369 }
1370}
1371
1372Vector<String> String::split_spaces() const
1373{

Callers 3

capitalizeMethod · 0.80
path_toMethod · 0.80

Calls 4

ptrMethod · 0.95
substrFunction · 0.85
StringClass · 0.70
is_emptyFunction · 0.50

Tested by

no test coverage detected