MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / join

Method join

core/string/ustring.cpp:1334–1373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334String String::join(const Vector<String> &parts) const {
1335 if (parts.is_empty()) {
1336 return String();
1337 } else if (parts.size() == 1) {
1338 return parts[0];
1339 }
1340
1341 const int this_length = length();
1342
1343 int new_size = (parts.size() - 1) * this_length;
1344 for (const String &part : parts) {
1345 new_size += part.length();
1346 }
1347 new_size += 1;
1348
1349 String ret;
1350 ret.resize_uninitialized(new_size);
1351 char32_t *ret_ptrw = ret.ptrw();
1352 const char32_t *this_ptr = ptr();
1353
1354 bool first = true;
1355 for (const String &part : parts) {
1356 if (first) {
1357 first = false;
1358 } else if (this_length) {
1359 memcpy(ret_ptrw, this_ptr, this_length * sizeof(char32_t));
1360 ret_ptrw += this_length;
1361 }
1362
1363 const int part_length = part.length();
1364 if (part_length) {
1365 memcpy(ret_ptrw, part.ptr(), part_length * sizeof(char32_t));
1366 ret_ptrw += part_length;
1367 }
1368 }
1369
1370 *ret_ptrw = 0;
1371
1372 return ret;
1373}
1374
1375char32_t String::char_uppercase(char32_t p_char) {
1376 return _find_upper(p_char);

Callers 15

build_gles3_headerFunction · 0.80
validate_archFunction · 0.80
get_mvk_sdk_pathFunction · 0.80
detect_mvkFunction · 0.80
get_git_infoFunction · 0.80
is_engineFunction · 0.80
get_filesFunction · 0.80
is_moduleFunction · 0.80
mySpawnFunction · 0.80
get_sizeFunction · 0.80

Calls 7

StringClass · 0.70
sizeMethod · 0.65
is_emptyMethod · 0.45
lengthMethod · 0.45
resize_uninitializedMethod · 0.45
ptrwMethod · 0.45
ptrMethod · 0.45

Tested by 2

mainFunction · 0.64
compact_spacesFunction · 0.64