MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / splitAny

Method splitAny

source/core/StarString.cpp:331–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331StringList String::splitAny(String const& chars, size_t maxSplit) const {
332 StringList ret;
333 String next;
334 bool doneSplitting = false;
335 for (auto c : *this) {
336 if (!doneSplitting && chars.hasCharOrWhitespace(c)) {
337 if (!next.empty())
338 ret.append(take(next));
339 } else {
340 if (ret.size() == maxSplit)
341 doneSplitting = true;
342 next.append(c);
343 }
344 }
345 if (!next.empty())
346 ret.append(std::move(next));
347 return ret;
348}
349
350StringList String::rsplitAny(String const& chars, size_t maxSplit) const {
351 // This is really inefficient!

Callers 12

isProfaneMethod · 0.80
CelestialCoordinateMethod · 0.80
VersioningDatabaseMethod · 0.80
guiFilterStringMethod · 0.80
makeRootCallbacksMethod · 0.80
determineRecipesMethod · 0.80
createRelativePathFunction · 0.80
parseAssetSourceFunction · 0.80
relativePathBaseMethod · 0.80
rsplitAnyMethod · 0.80
TESTFunction · 0.80
setPathMethod · 0.80

Calls 5

takeFunction · 0.85
hasCharOrWhitespaceMethod · 0.45
emptyMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64