
Module: Essential Tools Module Group: String Processing
Does not inherit
#include <rw/tools/nostl/cstring.h> RWCString a;
NOTE -- Use this class instead of RWCSubString only if Technical Support has advised you to do so.
The class RWClassicCSubString allows some subsection of an RWClassicCString to be addressed by defining a starting position and an extent.
For more information, see RWCSubString.
None
#include <rw/cstring.h>
#include <rw/rstream.h>
main(){
RWClassicCString s("What I tell you is true.");
// Create a substring and use it as an lvalue:
s(19, 0) = "three times ";
cout << s << endl;
}
Program output:
What I tell you is three times true.
RWClassicCSubString& operator=(const RWClassicCString&);
Assignment from an RWClassicCString. The statements:
RWClassicCString a; RWClassicCString 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 RWClassicCString. If self is the null substring, then the statement has no effect. Returns a reference to self.
RWClassicCSubString& operator=(const RWClassicCSubString&);
Assignment from an RWClassicCSubString. The statements:
RWClassicCString a; RWClassicCString b; ... b(2, 3) = a(5,5);
will 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 RWClassicCSubString. If self is the null substring, then the statement has no effect. Returns a reference to self.
RWClassicCSubString& operator=(const char*);
Assignment from a character string. Example:
RWClassicCString 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.
char& operator[](size_t i); char operator[](size_t i) const;
Returns the ith character of the substring. The first variant can be used as an lvalue, the second cannot. 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 RWBoundsErr will occur.
char& operator()(size_t i); char operator()(size_t i) const;
Returns the ith character of the substring. The first variant can be used as an lvalue, the second cannot. The index i must be between zero and the length of the substring, less one. Enable bounds checking by defining the pre-processor macro RWBOUNDS_CHECK before including <rw/cstring.h>. In this case, if the index is out of range, then an exception of type RWBoundsErr will occur.
RWBoolean isNull() const;
Returns TRUE if this is a null substring.
size_t length() const;
Returns the extent (i.e., length) of the RWClassicCSubString.
int operator!() const;
Returns TRUE if this is a null substring.
size_t start() const;
Returns the starting element of the RWClassicCSubString.
void toLower();
Changes all upper-case letters in self to lower-case. Uses the standard C library function tolower().
void toUpper();
Changes all lower-case letters in self to upper-case. Uses the standard C library function toupper().
RWBoolean
operator==(const RWClassicCSubString&, const
RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCString&,
const RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCSubString&,
const RWClassicCString& );
RWBoolean
operator==(const char*,
const RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCSubString&, const char* );
Returns TRUE if the substring is lexicographically equal to the character string or RWClassicCString argument. Case sensitivity is exact.
RWBoolean
operator!=(const RWClassicCString&,
const RWClassicCString& );
RWBoolean
operator!=(const RWClassicCString&,
const RWClassicCSubString&);
RWBoolean
operator!=(const RWClassicCSubString&,
const RWClassicCString& );
RWBoolean
operator!=(const char*,
const RWClassicCString& );
RWBoolean
operator!=(const RWClassicCString&, const char* );
RWBoolean
operator==(const RWClassicCSubString&, const
RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCString&,
const RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCSubString&,
const RWClassicCString& );
RWBoolean
operator==(const char*,
const RWClassicCSubString&);
RWBoolean
operator==(const RWClassicCSubString&, const char* );
Returns TRUE if the substring is lexicographically equal to the character string or RWClassicCString argument. Case sensitivity is exact.
RWBoolean
operator!=(const RWClassicCString&,
const RWClassicCString& );
RWBoolean
operator!=(const RWClassicCString&,
const RWClassicCSubString&);
RWBoolean
operator!=(const RWClassicCSubString&,
const RWClassicCString& );
RWBoolean
operator!=(const char*,
const RWClassicCString& );
RWBoolean
operator!=(const RWClassicCString&, const char* );
Returns the negation of the respective operator==().
©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.