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

Method joinWith

source/core/StarString.cpp:49–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49String String::joinWith(String const& join, String const& left, String const& right) {
50 if (left.empty())
51 return right;
52 if (right.empty())
53 return left;
54
55 if (left.endsWith(join)) {
56 if (right.beginsWith(join)) {
57 return left + right.substr(join.size());
58 }
59 return left + right;
60 } else {
61 if (right.beginsWith(join)) {
62 return left + right;
63 }
64 return left + join + right;
65 }
66}
67
68String::String() {}
69String::String(String const& s) : m_string(s.m_string) {}

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
endsWithMethod · 0.45
beginsWithMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected