MCPcopy Create free account
hub / github.com/cuberite/cuberite / TrimString

Function TrimString

src/StringUtils.cpp:165–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163
164
165AString TrimString(const AString & str)
166{
167 size_t len = str.length();
168 size_t start = 0;
169 while (start < len)
170 {
171 if (str[start] > 32)
172 {
173 break;
174 }
175 ++start;
176 }
177 if (start == len)
178 {
179 return "";
180 }
181
182 size_t end = len;
183 while (end >= start)
184 {
185 if (str[end] > 32)
186 {
187 break;
188 }
189 --end;
190 }
191
192 return str.substr(start, end - start + 1);
193}
194
195
196

Callers 9

BlockStringToTypeFunction · 0.85
StringToItemFunction · 0.85
LoadRecipesMethod · 0.85
ParseItemMethod · 0.85
ParseIngredientMethod · 0.85
InputThreadMethod · 0.85
StringSplitAndTrimFunction · 0.85
PushLineMethod · 0.85
ParsePackageFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected