BDE 4.14.0 Production release
|
#include <bdlb_string.h>
Static Public Member Functions | |
static bool | areEqualCaseless (const char *lhsString, const char *rhsString) |
static bool | areEqualCaseless (const char *lhsString, const char *rhsString, int rhsLength) |
static bool | areEqualCaseless (const char *lhsString, const bsl::string &rhsString) |
static bool | areEqualCaseless (const char *lhsString, int lhsLength, const char *rhsString) |
static bool | areEqualCaseless (const char *lhsString, int lhsLength, const char *rhsString, int rhsLength) |
static bool | areEqualCaseless (const char *lhsString, int lhsLength, const bsl::string &rhsString) |
static bool | areEqualCaseless (const bsl::string &lhsString, const char *rhsString) |
static bool | areEqualCaseless (const bsl::string &lhsString, const char *rhsString, int rhsLength) |
static bool | areEqualCaseless (const bsl::string &lhsString, const bsl::string &rhsString) |
static char * | copy (const char *string, bslma::Allocator *basicAllocator) |
static char * | copy (const char *string, int length, bslma::Allocator *basicAllocator) |
static char * | copy (const bsl::string &string, bslma::Allocator *basicAllocator) |
static int | lowerCaseCmp (const char *lhsString, const char *rhsString) |
static int | lowerCaseCmp (const char *lhsString, const char *rhsString, int rhsLength) |
static int | lowerCaseCmp (const char *lhsString, const bsl::string &rhsString) |
static int | lowerCaseCmp (const char *lhsString, int lhsLength, const char *rhsString) |
static int | lowerCaseCmp (const char *lhsString, int lhsLength, const char *rhsString, int rhsLength) |
static int | lowerCaseCmp (const char *lhsString, int lhsLength, const bsl::string &rhsString) |
static int | lowerCaseCmp (const bsl::string &lhsString, const char *rhsString) |
static int | lowerCaseCmp (const bsl::string &lhsString, const char *rhsString, int rhsLength) |
static int | lowerCaseCmp (const bsl::string &lhsString, const bsl::string &rhsString) |
static void | ltrim (char *string) |
static void | ltrim (bsl::string *string) |
static void | ltrim (std::string *string) |
static void | ltrim (char *string, int *length) |
static void | pad (bsl::string *string, int length, char padChar=' ') |
static void | pad (std::string *string, int length, char padChar=' ') |
static void | rtrim (char *string) |
static void | rtrim (bsl::string *string) |
static void | rtrim (std::string *string) |
static void | rtrim (const char *string, int *length) |
static const char * | strstr (const char *string, int stringLen, const char *subString, int subStringLen) |
static const char * | strstrCaseless (const char *string, int stringLen, const char *subString, int subStringLen) |
static const char * | strrstr (const char *string, int stringLen, const char *subString, int subStringLen) |
static const char * | strrstrCaseless (const char *string, int stringLen, const char *subString, int subStringLen) |
static int | strnlen (const char *string, int maximumLength) |
static void | toFixedLength (char *dstString, int dstLength, const char *srcString, int srcLength, char padChar=' ') |
static void | toLower (char *string) |
static void | toLower (char *string, int length) |
static void | toLower (bsl::string *string) |
static void | toLower (std::string *string) |
static void | toUpper (char *string) |
static void | toUpper (char *string, int length) |
static void | toUpper (bsl::string *string) |
static void | toUpper (std::string *string) |
static void | trim (char *string) |
static void | trim (bsl::string *string) |
static void | trim (std::string *string) |
static void | trim (char *string, int *length) |
static void | skipLeadingTrailing (const char **begin, const char **end) |
static int | upperCaseCmp (const char *lhsString, const char *rhsString) |
static int | upperCaseCmp (const char *lhsString, const char *rhsString, int rhsLength) |
static int | upperCaseCmp (const char *lhsString, const bsl::string &rhsString) |
static int | upperCaseCmp (const char *lhsString, int lhsLength, const char *rhsString) |
static int | upperCaseCmp (const char *lhsString, int lhsLength, const char *rhsString, int rhsLength) |
static int | upperCaseCmp (const char *lhsString, int lhsLength, const bsl::string &rhsString) |
static int | upperCaseCmp (const bsl::string &lhsString, const char *rhsString) |
static int | upperCaseCmp (const bsl::string &lhsString, const char *rhsString, int rhsLength) |
static int | upperCaseCmp (const bsl::string &lhsString, const bsl::string &rhsString) |
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.
|
inlinestatic |
Compare for equality the specified lhsString
and rhsString
having the optionally specified lhsLength
and rhsLength
, respectively, as if the strings were converted to lower case before the equality comparison. Return true
if lhsString
is equal to rhsString
, and false
otherwise. The behavior is undefined unless 0 <= lhsLength
and 0 <= rhsLength
(if specified), and lhsString.size() <= INT_MAX
and rhsString.size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having the same semantics taking bsl::string_view
.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
|
inlinestatic |
Create a null-terminated copy of the specified string
, using the specified basicAllocator
to supply memory, and return the address of the newly-created modifiable string. The string that is returned is owned by the caller. The behavior is undefined unless string.size() <= INT_MAX
and basicAllocator
is non-null. Note that if string
contains any embedded null ('\0') characters they will be propagated to the copy.
|
inlinestatic |
Create a null-terminated copy of the specified string
, using the specified basicAllocator
to supply memory, and return the address of the newly-created modifiable string. The string that is returned is owned by the caller. The behavior is undefined unless bsl::strlen(string) <= INT_MAX
and basicAllocator
is non-null.
|
static |
Create a null-terminated copy of the specified string
having the specified length
(in bytes), using the specified basicAllocator
to supply memory, and return the address of the newly-created modifiable string. The string that is returned is owned by the caller. The behavior is undefined unless 0 <= length
and basicAllocator
is non-null. Note that if string
contains any embedded null ('\0') characters they will be propagated to the copy.
|
inlinestatic |
Compare the specified lhsString
and rhsString
having the optionally specified lhsLength
and rhsLength
, respectively. Return 1 if, after conversion to lower case, lhsString
is lexically greater than rhsString
, 0 if they are equal up to a case conversion, and -1 otherwise. The behavior is undefined unless 0 <= lhsLength
and 0 <= rhsLength
(if specified), and lhsString.size() <= INT_MAX
and rhsString.size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having the same semantics taking bsl::string_view
.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
|
inlinestatic |
|
static |
|
static |
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
.
|
inlinestatic |
Remove all leading whitespace characters from the specified 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 string->size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having similar semantics taking (and returning) bsl::string_view
.
|
inlinestatic |
|
inlinestatic |
Append repeatedly to the specified string
the optionally specified padChar
until string
has the specified length
. If padChar
is not specified the space () character is appended. This operation has no effect if string.size() >= length
. The behavior is undefined unless 0 <= length
.
|
inlinestatic |
|
static |
|
static |
Determine the number of characters that the specified string
having the specified length
would have if all trailing whitespace characters were removed and load the result into *length
. string
is not modified. The behavior is undefined unless 0 <= *length
. Note that length
is both an input and output parameter.
|
inlinestatic |
Remove all trailing whitespace characters from the specified 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 string->size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having similar semantics taking (and returning) bsl::string_view
.
|
static |
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.
|
static |
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
.
|
static |
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
.
|
static |
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
.
|
static |
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
.
|
static |
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
.
|
static |
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
.
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
Replace all upper case characters in the specified string
having the optionally specified length
with their lower-case equivalent. The behavior is undefined unless 0 <= length
(if specified) and string->size() <= INT_MAX
(if applicable).
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
Replace all lower case characters in the specified string
having the optionally specified length
with their upper-case equivalent. The behavior is undefined unless 0 <= length
(if specified) and string->size() <= INT_MAX
(if applicable).
|
inlinestatic |
|
static |
|
inlinestatic |
Remove all leading and trailing 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
.
|
inlinestatic |
Remove all leading and trailing whitespace characters from the specified 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 string->size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having similar semantics taking (and returning) bsl::string_view
.
|
inlinestatic |
Compare the specified lhsString
and rhsString
having the optionally specified lhsLength
and rhsLength
, respectively, as if the strings were converted to upper case before the comparison. Return 1 if lhsString
is lexically greater than rhsString
, 0 if they are equal, and -1 otherwise. The behavior is undefined unless 0 <= lhsLength
and 0 <= rhsLength
(if specified), and lhsString.size() <= INT_MAX
and rhsString.size() <= INT_MAX
(if applicable). See bdlb_stringviewutil for an identically named method having the same semantics taking bsl::string_view
.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |