Does not inherit
assertElement() data() isNull() |
length() operator!() operator()() |
operator=() operator[]() start() |
toLower() toUpper() |
#include rwsf/core/CString.h
The class rwsf::CSubString allows some subsection of an rwsf::CString to be addressed by defining a starting position and an extent. For example the 7th through the 11th elements, inclusive, would have a starting position of 7 and an extent of 5. The specification of a starting position and extent can also be done in your behalf by such functions as rwsf::CString::strip() or the overloaded function call operator taking a regular expression as an argument. There are no public constructors rwsf::CSubStrings are constructed by various functions of the rwsf::CString class and then destroyed immediately.
A zero length substring is one with a defined starting position and an extent of zero. It can be thought of as starting just before the indicated character, but not including it. It can be used as an lvalue. A null substring is also legal and is frequently used to indicate that a requested substring, perhaps through a search, does not exist. A null substring can be detected with member function isNull(). However, it cannot be used as an lvalue.
Deprecated. Use std::string instead.
const char * data() const;
This member is deprecated and will be removed in a future version. It remains public only to maintain source compatibility.
Deprecated. Use startData() instead.
bool isNull() const;
Returns true if this is a null substring.
size_t length() const;
Returns the extent (i.e., length) of the rwsf::CSubString.
size_t start() const;
Returns the starting element of the rwsf::CSubString.
void toLower();
Changes all upper-case letters in self to lower-case.
Note
This function is incompatible with MBCS strings.
void toUpper();
Changes all lower-case letters in self to upper-case.
Note
This * function is incompatible with MBCS strings.
void assertElement(size_t i) const;
Verifies that i is a valid index.
int operator!() const;
Returns non-zero if the substring is null, 0 if non-null.
char & operator()(size_t i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. No bounds checking is performed.
char operator()(size_t i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. No bounds checking is performed.
char & operator[](short i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](int i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](long i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](unsigned short i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](unsigned int i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](unsigned long i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](rwsflonglong i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char & operator[](rwsfulonglong i);
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](short i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](int i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](long i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](unsigned short i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](unsigned int i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](unsigned long i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](rwsflonglong i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
char operator[](rwsfulonglong i) const;
Returns the ith character of the substring. The index i must be between zero and the length of the substring, less one. Bounds checking is performed: if the index is out of range, then an exception of type rwsf::OutOfBoundsException is thrown.
CSubString & operator=(const char *);
Assignment from a character string. Example:
rwsf::CString str("Mary had a lamb"); char dat[] = "Perrier"; str(11,4) = dat; // "Mary had a Perrier"
Note that the number of characters selected need not match: if they differ, str will be resized appropriately. Sets self's extent to be the strlen() of the assigned character string. If self is the null substring, then the statement has no effect. Returns a reference to self.
CSubString & operator=(const CString &);
Assignment from an rwsf::CString. The statements:
rwsf::CString a; rwsf::CString b; ... b(2, 3) = a;
will copy a's data into the substring b(2,3). The number of elements need not match: if they differ, b will be resized appropriately. Sets self's extent to be the length of the assigned rwsf::CString. If self is the null substring, then the statement has no effect. Returns a reference to self.
CSubString & operator=(const CSubString &);
Assignment from an rwsf::CSubString. The statements:
rwsf::CString a; rwsf::CString b; ... b(2, 3) = a(5,5);
copy 5 characters of a's data into the substring b(2,3). The number of elements need not match: if they differ, b will be resized appropriately. Sets self's extent to be the extent of the assigned rwsf::CSubString. If self is the null substring, then the statement has no effect. Returns a reference to self.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.