BloombergLP::bdlb::String::skipLeadingTrailing

Advance *begin and regress *end past surrounding whitespace.

Synopsis

Declared in <bdlb_string.h>

static
void
skipLeadingTrailing(
    char const** begin,
    char const** end);

Description

Skip leading and trailing whitespace characters in the string indicated by the specified *begin and *end iterators by appropriately advancing *begin and regressing *end. If the indicated string is empty, or consists solely of whitespace characters, *begin is unchanged and *end is regressed to *begin. Otherwise, advance *begin to the first non-whitespace character whose position is greater than or equal to *begin and regress *end to one past the position of the last non-whitespace character whose position is less than *end. The indicated string need not be null-terminated and may contain embedded null ('0') characters. The behavior is undefined unless *begin <= *end. Note that since *begin and *end are iterators, *end refers to the character one past the end of the subject string.

Parameters

NameDescription
beginiterator to the start of the string; advanced past leading whitespace
enditerator one past the end of the string; regressed past trailing whitespace