BloombergLP::bdlb::String::ltrim

Remove leading whitespace and update *length accordingly.

Synopsis

Declared in <bdlb_string.h>

static
void
ltrim(
    char* string,
    int* length);

Description

Remove all leading whitespace characters from the specified string having the specified length, and load into length the number of characters in the resulting (trimmed) string. If string consists of only whitespace then it will be empty (i.e., have 0 length) after this operation. The behavior is undefined unless 0 <= *length. Note that length is both an input and output parameter. See bdlb_stringviewutil for an identically named method having similar semantics taking (and returning) bsl::string_view.

Parameters

NameDescription
stringstring to trim
lengthlength of string; updated to the trimmed length