MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / strip_edges

Method strip_edges

modules/gui/gui/src/backend/text_server/ustring.cpp:4330–4371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4328}
4329
4330String String::strip_edges(bool left, bool right) const
4331{
4332 int len = length();
4333 int beg = 0, end = len;
4334
4335 if (left)
4336 {
4337 for (int i = 0; i < len; i++)
4338 {
4339 if (operator[](i) <= 32)
4340 {
4341 beg++;
4342 }
4343 else
4344 {
4345 break;
4346 }
4347 }
4348 }
4349
4350 if (right)
4351 {
4352 for (int i = len - 1; i >= 0; i--)
4353 {
4354 if (operator[](i) <= 32)
4355 {
4356 end--;
4357 }
4358 else
4359 {
4360 break;
4361 }
4362 }
4363 }
4364
4365 if (beg == 0 && end == len)
4366 {
4367 return *this;
4368 }
4369
4370 return substr(beg, end - beg);
4371}
4372
4373String String::strip_escapes() const
4374{

Callers 4

capitalizeMethod · 0.80
to_snake_caseMethod · 0.80
DTRFunction · 0.80
DTRNFunction · 0.80

Calls 2

substrFunction · 0.85
lengthFunction · 0.50

Tested by

no test coverage detected