Tools.h++ Class Reference

Table Of Contents
remove(size_t pos, size_t N);
Removes N bytes or to the end of string (whichever comes first) starting at the byte
position pos, which must be no greater than length(). Returns a reference to self.
RWCString&
replace(size_t pos, size_t N, const char* cs);
Replaces N bytes or to the end of string (whichever comes first) starting at byte position
pos, which must be no greater than length(), with a copy of the null-terminated string cs.
Returns a reference to self. This function is incompatible with cs strings with embedded
nulls. This function may be incompatible with cs MBCS strings.
RWCString&
replace(size_t pos, size_t N1,const char* cs, size_t N2);
Replaces N1 bytes or to the end of string (whichever comes first) starting at byte position
pos, which must be no greater than length(), with a copy of the string cs. Exactly N2 bytes
are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at
least N2 bytes long. Returns a reference to self.
RWCString&
replace(size_t pos, size_t N, const RWCString& str);
Replaces N bytes or to the end of string (whichever comes first) starting at byte position
pos, which must be no greater than length(), with a copy of the string str. Returns a
reference to self.
RWCString&
replace(size_t pos, size_t N1,const RWCString& str, size_t N2);
Replaces N1 bytes or to the end of string (whichever comes first) starting at position pos,
which must be no greater than length(), with a copy of the first N2 bytes, or the length of
str (whichever is less), from str. Returns a reference to self.
replace(const RWCRExpr& pattern, const char* replacement,
scopeType scope=one);
replace(const RWCRExpr& pattern,
const RWCString& replacement,scopeType scope=one);
Replaces substring matched by pattern with replacement string. pattern is the new
extended regular expression. scope is one of {one, all} and controls whether all matches of
pattern are replaced with replacement or just the first one match is replaced. replacement is
the replacement pattern for the string. Here's an example:
RWCString s("hahahohoheehee");
s.replace(RWCRExpr("(ho)+","HAR"); // s == "hahaHARheehee"
This function is incompatible with const char* replacement strings with embedded nulls.
This function may be incompatible with const char* replacement MBCS strings.
void
resize(size_t n);