MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / baseTrim

Method baseTrim

src/common/classes/fb_string.cpp:360–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358 }
359
360 void AbstractString::baseTrim(const TrimType whereTrim, const_pointer toTrim)
361 {
362 const strBitMask sm(toTrim, static_cast<size_type>(strlen(toTrim)));
363 const_pointer b = c_str();
364 const_pointer e = c_str() + length() - 1;
365 if (whereTrim != TrimRight)
366 {
367 while (b <= e)
368 {
369 if (! sm.Contains(*b)) {
370 break;
371 }
372 ++b;
373 }
374 }
375 if (whereTrim != TrimLeft)
376 {
377 while (b <= e)
378 {
379 if (! sm.Contains(*e)) {
380 break;
381 }
382 --e;
383 }
384 }
385 const size_type NewLength = e - b + 1;
386
387 if (NewLength == length())
388 return;
389
390 if (b != c_str())
391 {
392 memmove(stringBuffer, b, NewLength);
393 }
394 stringLength = NewLength;
395 stringBuffer[NewLength] = 0;
396 shrinkBuffer();
397 }
398
399 void AbstractString::printf(const char* format,...)
400 {

Callers

nothing calls this directly

Calls 2

lengthFunction · 0.50
ContainsMethod · 0.45

Tested by

no test coverage detected