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

Method findNextBoundary

source/core/StarString.cpp:592–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592size_t String::findNextBoundary(size_t index, bool backwards) const {
593 starAssert(index <= size());
594 if (!backwards && (index == size()))
595 return index;
596 if (backwards) {
597 if (index == 0)
598 return 0;
599 index--;
600 }
601 Char c = this->at(index);
602 while (!isSpace(c)) {
603 if (backwards && (index == 0))
604 return 0;
605 index += backwards ? -1 : 1;
606 if (index == size())
607 return size();
608 c = this->at(index);
609 }
610 while (isSpace(c)) {
611 if (backwards && (index == 0))
612 return 0;
613 index += backwards ? -1 : 1;
614 if (index == size())
615 return size();
616 c = this->at(index);
617 }
618 if (backwards && !(index == size()))
619 return index + 1;
620 return index;
621}
622
623String String::slice(SliceIndex a, SliceIndex b, int i) const {
624 auto wide = wideString();

Callers 1

innerSendEventMethod · 0.45

Calls 2

atMethod · 0.95
sizeFunction · 0.85

Tested by

no test coverage detected