BDE 4.14.0 Production release
|
Provide utility functions on STL-style and C-style strings.
This component defines a utility struct
, bdlb::String
, that provides a suite of functions operating on STL-style strings (bsl::string
, std::string
, std::pmr::string
), C-style strings (necessarily null-terminated), and strings specified by a (const char *, int)
or (char *, int)
pair.
Unlike C-style strings, strings specified via (const char *, int)
or (char *, int)
need not be null-terminated and may contain embedded null ('\0') characters. Note that if a string is specified by a const char *
and a length, the string address may be null only if 0 is supplied for the length; this is the only case where a null string argument is accepted by the functions of this utility. In particular, for strings specified by a char *
(to non-const
) and a length, the string address must not be null even if 0 is supplied for the length.
This component provides several kinds of utility functions, including both case-sensitive and case-insensitive comparisons, case conversions, trimming functions, and other length-related operations. Most of the methods are overloaded to work on three string styles: (1) STL-style (bsl::string
, std::string
, std::pmr::string
), (2) C-style, and (3) a (const char *, int)
or (char *, int)
pair. These overloaded methods are indicated schematically with a pseudo-argument STR
representing any of the three possible string styles. Note that the pseudo-signature foo(STR, STR)
represents nine overloaded signatures, not three.
Note that functions involving the case and classification of characters deal with base ASCII only. For example, for strings encoded in UTF-8, the functions behave as expected for the ASCII subset of UTF-8 but do not provide full Unicode support.
This section illustrates intended use of this component.
TBD