Tools.h++ Manual

104011 Tandem Computers Incorporated 21-75
21
i
must be between 0 and the length of the string 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;
Return the i’th character. The first variant can be used as an lvalue. The index
i
must be between 0 and the length of the string less one. Bounds checking is
performed if the pre-processor macro
RWBOUNDS_CHECK
has been defined
before including
<rw/cstring.h>
. In this case, if the index is out of range,
then an exception of type
RWBoundsErr
will occur.
RWCSubString operator()(size_t start,
size_t len);
const RWCSubString operator()(size_t start,
size_t len) const;
Substring operator. Returns a
RWCSubString
of self with length
len
, starting
at index
start
. The first variant can be used as an lvalue. The sum of
start
plus
len
must be less than or equal to the string length. If the library was built
using the
RWDEBUG
flag, and
start
and
len
are out of range, then an
exception of type
RWBoundsErr
will occur.
RWCSubString operator()(const RWCRegexp& re,
size_t start=0);
const RWCSubString operator()(const RWCRegexp& re,
size_t start=0) const;
Returns the first substring starting after index
start
that matches the regular
expression
re
. If there is no such substring, then the null substring is returned.
The first variant can be used as an lvalue.
Public member functions
RWCString& append(const char* cs);
Append a copy of the null-terminated character string pointed to by
cs
to self.
Returns a reference to self.
RWCString& append(const char* cs, size_t N);
Append a copy of the character string
cs
to self. Exactly
N
characters are
copied, including any embedded nulls. Hence, the buffer pointed to by
cs
must
be at least
N
bytes long. Returns a reference to self.
RWCString& append(const RWCString& cstr);
Append a copy of the string
cstr
to self. Returns a reference to self.