This struct provides a namespace for a suite of functions on STL‐style strings (bsl::string, std::string, std::pmr::string), C‐style strings, and strings specified by a (const char *, int) or (char *, int) pair.

Synopsis

Declared in <bdlb_string.h>

struct String;

Static Member Functions

Name

Description

areEqualCaseless

areEqualCaseless overloads

copy

copy overloads

lowerCaseCmp

lowerCaseCmp overloads

ltrim

ltrim overloads

pad

pad overloads

rtrim

rtrim overloads

skipLeadingTrailing

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.

strnlen

Return the minimum of the length of the specified string and the specified maximumLength. If maximumLength is 0, string may be null and 0 is returned. The behavior is undefined unless 0 <= maximumLength.

strrstr

Return the address providing non‐modifiable access to the last position in the specified string having stringLen characters at which the specified subString having subStringLen characters is found, or 0 if there is no such position. If subStringLen is 0, subString may be null and string + stringLen is returned. The behavior is undefined unless 0 <= stringLen and 0 <= subStringLen. See {`bdlb_stringviewutil`} for an identically named method having similar semantics taking (and returning) bsl::string_view.

strrstrCaseless

Return the address providing non‐modifiable access to the last position in the specified string having stringLen characters at which the specified subString having subStringLen characters is found using case‐insensitive comparison, or 0 if there is no such position. If subStringLen is 0, subString may be null and string + stringLen is returned. The behavior is undefined unless 0 <= stringLen and 0 <= subStringLen. See {`bdlb_stringviewutil`} for an identically named method having similar semantics taking (and returning) bsl::string_view.

strstr

Return the address providing non‐modifiable access to the first position in the specified string having stringLen characters at which the specified subString having subStringLen characters is found, or 0 if there is no such position. If subStringLen is 0, subString may be null and string is returned. The behavior is undefined unless 0 <= stringLen and 0 <= subStringLen. See {`bdlb_stringviewutil`} for an identically named method having similar semantics taking (and returning) bsl::string_view.

strstrCaseless

Return the address providing non‐modifiable access to the first position in the specified string having stringLen characters at which the specified subString having subStringLen characters is found using case‐insensitive comparison, or 0 if there is no such position. If subStringLen is 0, subString may be null and string is returned. The behavior is undefined unless 0 <= stringLen and 0 <= subStringLen. See {`bdlb_stringviewutil`} for an identically named method having similar semantics taking (and returning) bsl::string_view.

toFixedLength

Copy into the specified dstString at most the specified leading dstLength characters from the specified srcString having the specified srcLength. If srcLength < dstLength, after srcString is copied to dstString repeatedly append to dstString the optionally specified padChar until the total number of characters written to dstString is dstLength. If padChar is not specified the space (` ) character is appended. The behavior is undefined unless `0 <= dstLength and 0 <= srcLength.

toLower

toLower overloads

toUpper

toUpper overloads

trim

trim overloads

upperCaseCmp

upperCaseCmp overloads

Created with MrDocs