[#BloombergLP-bdlb-StringViewUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::StringViewUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for a suite of functions on `bsl::string_view` containers. == Synopsis Declared in `<bdlb_stringviewutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct StringViewUtil; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/StringViewUtil/size_type.adoc[`size_type`] | Size type of string_view containers. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/StringViewUtil/areEqualCaseless.adoc[`areEqualCaseless`] | Compare (the referent data of) the specified `lhs` and `rhs`. Return `true` if `lhs` and `rhs` are equal up to a case conversion, and `false` otherwise. See {Caseless Comparisons}. | xref:BloombergLP/bdlb/StringViewUtil/endsWith-02.adoc[`endsWith`] | `endsWith` overloads | xref:BloombergLP/bdlb/StringViewUtil/findFirstNotOf.adoc[`findFirstNotOf`] | Return the position of the _first_ occurrence of a character _not_ belonging to the specified `characters`, if such an occurrence can be found in the specified `string` (on or _after_ the optionally specified `position` if such a `position` is specified), and return `k_NPOS` otherwise. | xref:BloombergLP/bdlb/StringViewUtil/findFirstOf.adoc[`findFirstOf`] | Return the position of the _first_ occurrence of a character belonging to the specified `characters`, if such an occurrence can can be found in the specified `string` (on or _after_ the optionally specified `position` if such a `position` is specified), and return `k_NPOS` otherwise. | xref:BloombergLP/bdlb/StringViewUtil/findLastNotOf.adoc[`findLastNotOf`] | Return the position of the _last_ occurrence of a character _not_ belonging to the specified `characters`, if such an occurrence can be found in the specified `string` (on or _before_ the optionally specified `position` if such a `position` is specified), and return `k_NPOS` otherwise. | xref:BloombergLP/bdlb/StringViewUtil/findLastOf.adoc[`findLastOf`] | Return the position of the _last_ occurrence of a character belonging to the specified `characters`, if such an occurrence can can be found in the specified `string` (on or _before_ the optionally specified `position` if such a `position` is specified), and return `k_NPOS` otherwise. | xref:BloombergLP/bdlb/StringViewUtil/lowerCaseCmp.adoc[`lowerCaseCmp`] | Compare (the referent data of) the specified `lhs` and `rhs`. Return 1 if, after a conversion to lower case, `lhs` is greater than `rhs`, 0 if `lhs` and `rhs` are equal up to a case conversion, and ‐1 otherwise. See {Caseless Comparisons}. | xref:BloombergLP/bdlb/StringViewUtil/ltrim.adoc[`ltrim`] | Return a `bsl::string_view` object referring to the substring of (the referent data of) the specified `string` that excludes all leading whitespace. See {Whitespace Character Specification}. If `string` consists entirely of whitespace, return a zero‐length reference to the end of `string` (i.e., `bsl::string_view(string.end(), 0)`). | xref:BloombergLP/bdlb/StringViewUtil/rtrim.adoc[`rtrim`] | Return a `bsl::string_view` object referring to the substring of (the referent data of) the specified `string` that excludes all trailing whitespace. See {Whitespace Character Specification}. If `string` consists entirely of whitespace, return a zero‐length reference to the beginning of (the referent data of) `string` (i.e., `bsl::string_view(string.data(), 0)`). | xref:BloombergLP/bdlb/StringViewUtil/startsWith-00.adoc[`startsWith`] | `startsWith` overloads | xref:BloombergLP/bdlb/StringViewUtil/strrstr.adoc[`strrstr`] | Return a `bsl::string_view` object referring to the last occurrence in (the referent data of) the specified `string` at which (the referent data of) the specified `subString` is found, or `bsl::string_view()` if there is no such occurrence. If `subString` has zero length then a zero‐length reference to the end of `string` is returned (i.e., `bsl::string_view(string.end(), 0)`); | xref:BloombergLP/bdlb/StringViewUtil/strrstrCaseless.adoc[`strrstrCaseless`] | Return a `bsl::string_view` object referring to the last occurrence in (the referent data of) the specified `string` at which (the referent data of) the specified `subString` is found using case‐insensitive comparisons, or `bsl::string_view()` if there is no such occurrence. See {Caseless Comparisons}. If `subString` has zero length then a zero‐length reference to the end of `string` is returned (i.e., `bsl::string_view(string.end(), 0)`); | xref:BloombergLP/bdlb/StringViewUtil/strstr.adoc[`strstr`] | Return a `bsl::string_view` object referring to the first occurrence in (the referent data of) the specified `string` at which (the referent data of) the specified `subString` is found, or `bsl::string_view()` if there is no such occurrence. If `subString` has zero length then a zero‐length reference to the beginning of `string` is returned (i.e., `bsl::string_view(string.data(), 0)`); | xref:BloombergLP/bdlb/StringViewUtil/strstrCaseless.adoc[`strstrCaseless`] | Return a `bsl::string_view` object referring to the first occurrence in (the referent data of) the specified `string` at which (the referent data of) the specified `subString` is found using case‐insensitive comparisons, or `bsl::string_view()` if there is no such occurrence. See {Caseless Comparisons}. If `subString` has zero length then a zero‐length reference to the beginning of `string` is returned (i.e., `bsl::string_view(string.data(), 0)`); | xref:BloombergLP/bdlb/StringViewUtil/substr.adoc[`substr`] | Return a string whose value is the substring starting at the optionally specified `position` in the specified `string`, of length the optionally specified `numChars` or `length() ‐ position`, whichever is smaller. If `position` is not specified, 0 is used (i.e., the substring is from the beginning of this string). If `numChars` is not specified, `k_NPOS` is used (i.e., the entire suffix from `position` to the end of the string is returned). The behavior is undefined unless `position` is within the string boundaries (`0 <= position <= string.length()`). | xref:BloombergLP/bdlb/StringViewUtil/trim.adoc[`trim`] | Return a `bsl::string_view` object referring to the substring of (the referent data of) the specified `string` that excludes all leading and trailing whitespace. See {Whitespace Character Specification}. If `string` consists entirely of whitespace, return a zero‐length reference to the beginning of (the referent data of) `string` (i.e., `bsl::string_view(string.data(), 0)`). | xref:BloombergLP/bdlb/StringViewUtil/upperCaseCmp.adoc[`upperCaseCmp`] | Compare (the referent data of) the specified `lhs` and `rhs`. Return 1 if, after a conversion to upper case, `lhs` is greater than `rhs`, 0 if `lhs` and `rhs` are equal up to a case conversion, and ‐1 otherwise. See {Caseless Comparisons}. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/StringViewUtil/k_NPOS.adoc[`k_NPOS`] | Value used to denote "not‐a‐position", guaranteed to be outside the `range[0 .. bsl::string_view::max_size()]`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#