rwlogo
SourcePro 11.1

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWCString Class Reference
[String Processing]

Offers powerful and convenient facilities for manipulating strings. More...

#include <rw/tools/cstring.h>

Inheritance diagram for RWCString:
RWCollectableString RWDBMBString RWStringID

List of all members.

Public Types

enum  stripType { leading, trailing, both }
enum  caseCompare { exact, ignoreCase, ignoreCaseStrict }
enum  scopeType { one, all }

Public Member Functions

 RWCString ()
 RWCString (const std::string &s)
 RWCString (const RWCString &str)
 RWCString (char c, size_t N)
 RWCString (const char *s)
 RWCString (const char *s, size_t N)
 RWCString (char c)
 RWCString (signed char c)
 RWCString (unsigned char c)
 RWCString (const RWCSubString &ss)
 RWCString (const RWCConstSubString &ss)
RWCStringoperator= (const char *s)
RWCStringoperator= (const std::string &data)
RWCStringoperator= (const RWCString &str)
char & operator() (size_t i)
char operator() (size_t i) const
char & operator[] (short i)
char & operator[] (int i)
char & operator[] (long i)
char & operator[] (unsigned short i)
char & operator[] (unsigned int i)
char & operator[] (unsigned long i)
char operator[] (short i) const
char operator[] (int i) const
char operator[] (long i) const
char operator[] (unsigned short i) const
char operator[] (unsigned int i) const
char operator[] (unsigned long i) const
char & operator[] (long long i)
char & operator[] (unsigned long long i)
char operator[] (long long i) const
char operator[] (unsigned long long i) const
SubStringType operator() (size_t start, size_t len)
ConstSubStringType operator() (size_t start, size_t len) const
SubStringType operator() (const RWCRegexp &re)
ConstSubStringType operator() (const RWCRegexp &re) const
SubStringType operator() (const RWCRegexp &re, size_t start)
ConstSubStringType operator() (const RWCRegexp &re, size_t start) const
SubStringType match (const RWTRegularExpression< char > &re)
SubStringType match (const RWTRegularExpression< char > &re, size_t start)
ConstSubStringType match (const RWTRegularExpression< char > &re, size_t start) const
SubStringType subString (const char *cs, size_t start=0, caseCompare cmp=exact)
ConstSubStringType subString (const char *cs, size_t start=0, caseCompare cmp=exact) const
SubStringType strip (stripType s=trailing, char c=static_cast< char >( ' '))
ConstSubStringType strip (stripType s=trailing, char c=static_cast< char >( ' ')) const
RWCStringappend (char c, size_t N=1)
RWCStringappend (const char *cs)
RWCStringappend (const char *cs, size_t N)
RWCStringappend (const std::string &str, size_t N)
RWCStringappend (const RWCString &str, size_t N)
RWCStringappend (const RWCString &str)
RWCStringappend (const std::string &str)
RWCStringoperator+= (const char *cs)
RWCStringoperator+= (const std::string str)
RWCStringoperator+= (const RWCString &str)
RWspace binaryStoreSize () const
size_t capacity () const
size_t capacity (size_t capac)
 RWCString (RWSize_T ic)
int collate (const char *str) const
int collate (const std::string &str) const
int collate (const RWCString &str) const
int compareTo (const char *str, caseCompare cmp=exact) const
int compareTo (const std::string &str, caseCompare cmp=exact) const
int compareTo (const std::string *str, caseCompare cmp=exact) const
int compareTo (const RWCString &str, caseCompare cmp=exact) const
int compareTo (const RWCString *str, caseCompare cmp=exact) const
bool contains (const char *str, caseCompare cmp=exact) const
bool contains (const std::string &str, caseCompare cmp=exact) const
bool contains (const RWCString &str, caseCompare cmp=exact) const
const char * data () const
std::string & std ()
size_t first (char c) const
size_t first (char c, size_t) const
size_t first (const char *str) const
size_t first (const char *str, size_t N) const
unsigned long hash (caseCompare cmp=exact) const
size_t index (const char pat, size_t i=0, caseCompare cmp=exact) const
size_t index (const char *pat, size_t i=0, caseCompare cmp=exact) const
size_t index (const std::string &pat, size_t i=0, caseCompare cmp=exact) const
size_t index (const RWCString &pat, size_t i=0, caseCompare cmp=exact) const
size_t index (const char *pat, size_t patlen, size_t i, caseCompare cmp) const
size_t index (const std::string &pat, size_t patlen, size_t i, caseCompare cmp) const
size_t index (const RWCString &pat, size_t patlen, size_t i, caseCompare cmp) const
size_t index (const RWCRegexp &re, size_t i=0) const
size_t index (const RWTRegularExpression< char > &re, size_t i=0) const
size_t index (const RWCRegexp &re, size_t *ext, size_t i=0) const
size_t index (const RWTRegularExpression< char > &re, size_t *ext, size_t i=0) const
size_t index (const char *re, size_t *ext, size_t i=0) const
RWCStringinsert (size_t pos, const char *cs)
RWCStringinsert (size_t pos, const std::string &str)
RWCStringinsert (size_t pos, const RWCString &str)
RWCStringinsert (size_t pos, const char *cs, size_t N)
RWCStringinsert (size_t pos, const std::string &str, size_t N)
RWCStringinsert (size_t pos, const RWCString &str, size_t N)
bool isAscii () const
bool isNull () const
size_t last (char c) const
size_t last (const char *s) const
size_t last (char c, size_t N) const
size_t last (const char *s, size_t N) const
size_t length () const
size_t mbLength () const
RWCStringprepend (char c, size_t N=1)
RWCStringprepend (const char *cs)
RWCStringprepend (const std::string &str)
RWCStringprepend (const char *cs, size_t N)
RWCStringprepend (const std::string &cstr, size_t N)
RWCStringprepend (const RWCString &cstr, size_t N)
std::istream & readFile (std::istream &s)
std::istream & readLine (std::istream &s, bool skipWhite=true)
std::istream & readString (std::istream &s)
std::istream & readToDelim (std::istream &s, char delim='\n')
std::istream & readToken (std::istream &s)
RWCStringremove (size_t pos)
RWCStringremove (size_t pos, size_t N)
RWCStringreplace (size_t pos, size_t N, const char *cs)
RWCStringreplace (size_t pos, size_t N, const std::string &str)
RWCStringreplace (size_t pos, size_t N, const RWCString &str)
RWCStringreplace (size_t pos, size_t N1, const char *cs, size_t N2)
RWCStringreplace (size_t pos, size_t N1, const RWCString &str, size_t N2)
RWCStringreplace (size_t pos, size_t N1, const std::string &str, size_t N2)
RWCStringreplace (const RWTRegularExpression< char > &pattern, const char *replacement, scopeType scope=one)
RWCStringreplace (const RWTRegularExpression< char > &pattern, const RWCString &replacement, scopeType scope=one)
void resize (size_t N)
size_t rindex (const char *pat, caseCompare cmp) const
size_t rindex (const char pat, size_t i=RW_NPOS, caseCompare cmp=exact) const
size_t rindex (const char *pat, size_t i=RW_NPOS, caseCompare cmp=exact) const
size_t rindex (const std::string &pat, size_t i=RW_NPOS, caseCompare cmp=exact) const
size_t rindex (const RWCString &pat, size_t i=RW_NPOS, caseCompare cmp=exact) const
size_t rindex (const char *pat, size_t patlen, size_t i, caseCompare cmp) const
size_t rindex (const std::string &pat, size_t patlen, size_t i, caseCompare cmp) const
size_t rindex (const RWCString &pat, size_t patlen, size_t i, caseCompare cmp) const
void toLower ()
void toUpper ()
bool operator== (const RWCString &str) const
bool operator!= (const RWCString &str) const
bool operator< (const RWCString &str) const
bool operator> (const RWCString &str) const
bool operator<= (const RWCString &str) const
bool operator>= (const RWCString &str) const

Static Public Member Functions

static unsigned hash (const RWCString &str)
static size_t initialCapacity (size_t n=15)
static size_t maxWaste (size_t)
static size_t resizeIncrement (size_t n=16)
static size_t mbLength (const char *str, size_t nBytes=RW_NPOS)
static size_t byteCount (const char *str, size_t nChars=RW_NPOS)

Friends

RWCString operator+ (const RWCString &str1, const RWCString &str2)
RWCString operator+ (const RWCString &str, const char *s)
RWCString operator+ (const char *s, const RWCString &str)
RWCString operator+ (const RWCString &str1, const std::string &str2)
RWCString operator+ (const std::string &str1, const RWCString &str2)

Related Functions

(Note that these are not member functions.)



RWCString toLower (const RWCString &str)
RWCString toUpper (const RWCString &str)
RWCString strXForm (const std::string &str)
std::istream & operator>> (std::istream &is, RWCString &str)
std::ostream & operator<< (std::ostream &os, const RWCString &str)
RWvostreamoperator<< (RWvostream &vos, const RWCString &str)
RWFileoperator<< (RWFile &file, const RWCString &str)
RWvistreamoperator>> (RWvistream &vis, RWCString &str)
RWFileoperator>> (RWFile &file, RWCString &str)
bool operator== (const RWCString &s1, const char *s2)
bool operator== (const char *s1, const RWCString &s2)
bool operator== (const RWCString &s1, const std::string &s2)
bool operator== (const std::string &s1, const RWCString &s2)
bool operator!= (const RWCString &s1, const char *s2)
bool operator!= (const char *s1, const RWCString &s2)
bool operator!= (const RWCString &s1, const std::string &s2)
bool operator!= (const std::string &s1, const RWCString &s2)
bool operator< (const RWCString &s1, const char *s2)
bool operator< (const char *s1, const RWCString &s2)
bool operator< (const RWCString &s1, const std::string &s2)
bool operator< (const std::string &s1, const RWCString &s2)
bool operator> (const RWCString &s1, const char *s2)
bool operator> (const char *s1, const RWCString &s2)
bool operator> (const RWCString &s1, const std::string &s2)
bool operator> (const std::string &s1, const RWCString &s2)
bool operator<= (const RWCString &s1, const char *s2)
bool operator<= (const char *s1, const RWCString &s2)
bool operator<= (const RWCString &s1, const std::string &s2)
bool operator<= (const std::string &s1, const RWCString &s2)
bool operator>= (const RWCString &s1, const char *s2)
bool operator>= (const char *s1, const RWCString &s2)
bool operator>= (const RWCString &s1, const std::string &s2)
bool operator>= (const std::string &s1, const RWCString &s2)
bool operator== (const RWCString &str, char c)
bool operator== (char c, const RWCString &str)
bool operator!= (const RWCString &str, char c)
bool operator!= (char c, const RWCString &str)
bool operator< (const RWCString &str, char c)
bool operator< (char c, const RWCString &str)
bool operator<= (const RWCString &str, char c)
bool operator<= (char c, const RWCString &str)
bool operator> (const RWCString &str, char c)
bool operator> (char c, const RWCString &str)
bool operator>= (const RWCString &str, char c)
bool operator>= (char c, const RWCString &str)

Detailed Description

Class RWCString offers powerful and convenient facilities for manipulating strings.

Note:
RWCString is designed for use with multibyte character sequences. To manipulate wide character strings, use RWWString.

Although the class is primarily intended to be used to handle single-byte character sets (SBCS; such as US-ASCII or ISO Latin-1), with care it can be used to handle multibyte character sets (MBCS). There are two things that must be kept in mind when working with MBCS:

Parameters of type const char* must not be passed a value of zero. This is detected in the debug version of the library.

A separate class RWCSubString supports substring extraction and modification operations. RWCConstSubString supports substring extractions on const RWCString instances.

Synopsis

 #include <rw/cstring.h>
 RWCString a;

Persistence

Simple

Examples

 #include <iostream>
 #include <rw/re.h>
 #include <rw/cstring.h>
 
 int main()
 {
     RWCString a("There is no joy in Beantown.");
 
     std::cout << "\"" << a << "\"" << " becomes ";
 
     // Any capitalized "town"
     RWCRExpr re("[A-Z][a-z]*town");
     a.replace(re, "Redmond");
 
     std::cout << "\"" << a << "\"" << std::endl;
 
     return 0;
 }

Program output:

 "These is no joy in Beantown" becomes "There is no joy in Redmond."

Member Enumeration Documentation

Specifies whether comparisons, searches, and hashing functions should use case sensitive (exact) or case-insensitive (ignoreCase) semantics.

Enumerator:
exact 

match exactly

ignoreCase 

case-insensitive

ignoreCaseStrict 

case-insensitive for alpha characters only

Specifies whether regular expression replace replaces the first one substring matched by the regular expression or replaces all substrings matched by the regular expression.

Enumerator:
one 

replaces first substring matched.

all 

replaces all substrings matched.

Specifies whether characters are stripped from the beginning of the string, the end, or both.

Enumerator:
leading 

Remove characters at beginning.

trailing 

Remove characters at end.

both 

Remove characters at both ends.


Constructor & Destructor Documentation

RWCString::RWCString (  )  [inline]

Creates a string of length zero (the null string).

RWCString::RWCString ( const std::string &  s  )  [inline]

Constructs an RWCString with one element s.

RWCString::RWCString ( const RWCString str  )  [inline]

Copy constructor. The created string copies the data from str.

RWCString::RWCString ( char  c,
size_t  N 
) [inline]

Constructs a string containing the character c repeated N times.

RWCString::RWCString ( const char *  s  )  [inline]

Converts from the null-terminated character string s. The created string copies the data pointed to by s, up to the first terminating null. This function is incompatible with s strings with embedded nulls. This function may be incompatible with s MBCS strings.

RWCString::RWCString ( const char *  s,
size_t  N 
) [inline]

Constructs a string from the character string cs. The created string copies the data pointed to by cs. Exactly N bytes are copied, including any embedded nulls. Hence, the buffer pointed to by cs must be at least N bytes long.

RWCString::RWCString ( char  c  )  [inline]

Constructs a string containing the single character c.

RWCString::RWCString ( signed char  c  )  [inline]

Constructs a string containing the single signed character c.

RWCString::RWCString ( unsigned char  c  )  [inline]

Constructs a string containing the single unsigned character c.

RWCString::RWCString ( const RWCSubString ss  )  [inline]

Converts from a sub-string. The created string copies the substring represented by ss.

RWCString::RWCString ( const RWCConstSubString ss  )  [inline]

Converts from a const substring. The created string copies the substring represented by ss.

RWCString::RWCString ( RWSize_T  ic  )  [inline]

Creates a string of length zero (the null string). The string's capacity (that is, the size it can grow to without resizing) is given by the parameter ic. We recommend creating an RWSize_T value from a numerical constant to pass into this constructor. While RWSize_T knows how to convert size_t values to itself, conforming compilers choose the conversion to char instead.


Member Function Documentation

RWCString& RWCString::append ( const std::string &  str  )  [inline]

Appends a copy of the string str to self. Returns a reference to self.

RWCString& RWCString::append ( const RWCString str  )  [inline]

Appends a copy of the string str to self. Returns a reference to self.

RWCString & RWCString::append ( const RWCString str,
size_t  N 
) [inline]

Appends the first N bytes or the length of str (whichever is less) to self. Returns a reference to self.

RWCString & RWCString::append ( const std::string &  str,
size_t  N 
) [inline]

Appends the first N bytes or the length of str (whichever is less) to self. Returns a reference to self.

RWCString & RWCString::append ( const char *  cs,
size_t  N 
) [inline]

Appends a copy of the character string cs to self. Exactly N bytes 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& RWCString::append ( const char *  cs  )  [inline]

Appends a copy of the null-terminated character string pointed to by cs to self. 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& RWCString::append ( char  c,
size_t  N = 1 
) [inline]

Appends N copies of the character c to self. Returns a reference to self.

RWspace RWCString::binaryStoreSize (  )  const [inline]

Returns the number of bytes necessary to store the object using the global function:

Reimplemented in RWCollectableString.

static size_t RWCString::byteCount ( const char *  str,
size_t  nChars = RW_NPOS 
) [static]

Given a multibyte sequence, str, and a number of multibyte characters to consider, nChars, this method calculates the number of bytes required to store the sequence. If nChars is RW_NPOS, then the method counts characters up to, but not including, the first NULL character in the sequence. The method returns the number of bytes required to represent the string. If an error occurs during the operation, then RW_NPOS is returned.

size_t RWCString::capacity ( size_t  capac  )  [inline]

Hints to the implementation to change the capacity of self to capac. Returns the actual capacity.

Reimplemented in RWStringID.

size_t RWCString::capacity (  )  const [inline]

Returns the current capacity of self. This is the number of bytes the string can hold without resizing.

Reimplemented in RWStringID.

int RWCString::collate ( const RWCString str  )  const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function strcoll() on self and the argument str. This supports locale-dependent collation. Provided only on platforms that provide strcoll(). This function is incompatible with strings with embedded nulls.

Reimplemented in RWStringID.

int RWCString::collate ( const std::string &  str  )  const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function strcoll() on self and the argument str. This supports locale-dependent collation. Provided only on platforms that provide strcoll(). This function is incompatible with strings with embedded nulls.

int RWCString::collate ( const char *  str  )  const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function strcoll() on self and the argument str. This supports locale-dependent collation. Provided only on platforms that provide strcoll(). This function is incompatible with strings with embedded nulls.

Reimplemented in RWStringID.

int RWCString::compareTo ( const RWCString str,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function memcmp() on self and the argument str. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

int RWCString::compareTo ( const RWCString str,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function memcmp() on self and the argument str. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

Reimplemented in RWCollectableString, and RWStringID.

int RWCString::compareTo ( const std::string *  str,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function memcmp() on self and the argument str. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

int RWCString::compareTo ( const std::string &  str,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function memcmp() on self and the argument str. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

int RWCString::compareTo ( const char *  str,
caseCompare  cmp = exact 
) const [inline]

Returns an int less than, greater than, or equal to zero, according to the result of calling the Standard C Library function memcmp() on self and the argument str. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

Reimplemented in RWCollectableString, and RWStringID.

bool RWCString::contains ( const RWCString str,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Returns true if str occurs in self. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

Reimplemented in RWStringID.

bool RWCString::contains ( const std::string &  str,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Returns true if str occurs in self. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

bool RWCString::contains ( const char *  str,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Returns true if str occurs in self. Case sensitivity is according to the caseCompare argument, and may be RWCString::exact or RWCString::ignoreCase. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings. This function is incompatible with const char* strings with embedded nulls. This function may be incompatible with const char* MBCS strings.

Reimplemented in RWStringID.

const char* RWCString::data ( void   )  const [inline]

Provides access to the RWCString objects's data as a null terminated string. This datum is owned by the RWCString and may not be deleted or changed. If the RWCString object itself changes or goes out of scope, the pointer value previously returned becomes invalid. While the string is null terminated, note that its length is still given by the member function length(). That is, it may contain embedded nulls.

size_t RWCString::first ( const char *  str,
size_t  N 
) const [inline]

Returns the index of the first occurrence in self of any character in str. Exactly N bytes in str are checked including any embedded nulls so str must point to a buffer containing at least N bytes. Returns RW_NPOS if there is no match.

size_t RWCString::first ( const char *  str  )  const [inline]

Returns the index of the first occurrence in self of any character in str. Returns RW_NPOS if there is no match or if there is an embedded null prior to finding any character from str. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::first ( char  c,
size_t   
) const [inline]

Returns the index of the first occurrence of the character c in self. Continues to search past embedded nulls. Returns RW_NPOS if there is no such character. This function is incompatible with MBCS strings.

size_t RWCString::first ( char  c  )  const [inline]

Returns the index of the first occurrence of the character c in self. Returns RW_NPOS if there is no such character or if there is an embedded null prior to finding c. This function is incompatible with strings with embedded nulls and with MBCS strings.

Reimplemented in RWStringID.

unsigned long RWCString::hash ( caseCompare  cmp = exact  )  const

Returns a suitable hash value. If caseCompare is RWCString::ignoreCase then this function is incompatible with MBCS strings.

Reimplemented in RWCollectableString.

static unsigned RWCString::hash ( const RWCString str  )  [inline, static]

Returns the hash value of str as returned by hash(caseCompare) const, where caseCompare is RWCString::exact.

Reimplemented in RWCollectableString.

size_t RWCString::index ( const char *  re,
size_t *  ext,
size_t  i = 0 
) const

Regular expression matching. Returns the index greater than or equal to i of the start of the first pattern that matches the regular expression re. Returns RW_NPOS if there is no such pattern. This function returns the length of the matching pattern in the variable pointed to by ext. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const RWTRegularExpression< char > &  re,
size_t *  ext,
size_t  i = 0 
) const

Regular expression matching. Returns the index greater than or equal to i of the start of the first pattern that matches the regular expression re. Returns RW_NPOS if there is no such pattern. This function returns the length of the matching pattern in the variable pointed to by ext. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

size_t RWCString::index ( const RWCRegexp re,
size_t *  ext,
size_t  i = 0 
) const

Regular expression matching. Returns the index greater than or equal to i of the start of the first pattern that matches the regular expression re. Returns RW_NPOS if there is no such pattern. This function returns the length of the matching pattern in the variable pointed to by ext. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const RWTRegularExpression< char > &  re,
size_t  i = 0 
) const

Regular expression matching. Returns the index greater than or equal to i of the start of the first pattern that matches the regular expression re. Returns RW_NPOS if there is no such pattern. This function is incompatible with MBCS strings.

size_t RWCString::index ( const RWCRegexp re,
size_t  i = 0 
) const

Regular expression matching. Returns the index greater than or equal to i of the start of the first pattern that matches the regular expression re. Returns RW_NPOS if there is no such pattern. This function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const RWCString pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of the first patlen bytes from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const std::string &  pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of the first patlen bytes from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

size_t RWCString::index ( const char *  pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of the first patlen bytes from pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const RWCString pat,
size_t  i = 0,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const std::string &  pat,
size_t  i = 0,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

size_t RWCString::index ( const char *  pat,
size_t  i = 0,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::index ( const char  pat,
size_t  i = 0,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the first occurrence of pat in self and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::exact, then this function works for all string types. Otherwise, this function is incompatible with MBCS strings.

static size_t RWCString::initialCapacity ( size_t  n = 15  )  [inline, static]
Deprecated:
This method is deprecated and is provided only for API compatability. It has no effect on an RWCString instance and may be removed from a future release.
RWCString & RWCString::insert ( size_t  pos,
const RWCString str,
size_t  N 
) [inline]

Inserts a copy of the first N bytes or the length of str (whichever is less) into self at byte position pos. Returns a reference to self.

RWCString & RWCString::insert ( size_t  pos,
const std::string &  str,
size_t  N 
) [inline]

Inserts a copy of the first N bytes or the length of str (whichever is less) into self at byte position pos. Returns a reference to self.

RWCString & RWCString::insert ( size_t  pos,
const char *  cs,
size_t  N 
) [inline]

Inserts a copy of the first N bytes of cs into self at byte position pos, thus expanding the string. Exactly N bytes 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 & RWCString::insert ( size_t  pos,
const RWCString str 
) [inline]

Inserts a copy of the string str into self at byte position pos. Returns a reference to self.

RWCString & RWCString::insert ( size_t  pos,
const std::string &  str 
) [inline]

Inserts a copy of the string str into self at byte position pos. Returns a reference to self.

RWCString & RWCString::insert ( size_t  pos,
const char *  cs 
) [inline]

Inserts a copy of the null-terminated string cs into self at byte position pos, thus expanding the string. Returns a reference to self. This function is incompatible with cs strings with embedded nulls and may be incompatible with cs MBCS strings.

bool RWCString::isAscii (  )  const

Returns true if self contains no bytes with the high bit set.

bool RWCString::isNull ( void   )  const [inline]

Returns true if this is a zero length string (i.e., the null string).

size_t RWCString::last ( const char *  s,
size_t  N 
) const [inline]

Returns the index of the last occurrence in the string of the character c. Continues to search past embedded nulls. Returns RW_NPOS if there is no such character. This function is incompatible with MBCS strings.

size_t RWCString::last ( char  c,
size_t  N 
) const [inline]

Returns the index of the last occurrence in the string of the character c. Continues to search past embedded nulls. Returns RW_NPOS if there is no such character. This function is incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::last ( const char *  s  )  const [inline]

Returns the index of the last occurrence in the string of the character c. Returns RW_NPOS if there is no such character or if there is an embedded null to the right of c in self. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

size_t RWCString::last ( char  c  )  const [inline]

Returns the index of the last occurrence in the string of the character c. Returns RW_NPOS if there is no such character or if there is an embedded null to the right of c in self. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

Reimplemented in RWStringID.

size_t RWCString::length (  )  const [inline]

Returns the number of bytes in self. Note that if self contains multibyte characters, then this is not the number of characters.

ConstSubStringType RWCString::match ( const RWTRegularExpression< char > &  re,
size_t  start 
) const

Returns the first substring starting after index start that matches the regular expression re. If there is no such substring, then this function returns the null substring.

Note:
This is used in place of operator()(const RWCRegexp&) and its variants, if you want to use extended regular expressions.

SubStringType RWCString::match ( const RWTRegularExpression< char > &  re,
size_t  start 
)

Returns the first substring starting after index start that matches the regular expression re. If there is no such substring, then this function returns the null substring.

Note:
This is used in place of operator()(const RWCRegexp&) and its variants, if you want to use extended regular expressions.
SubStringType RWCString::match ( const RWTRegularExpression< char > &  re  ) 

Returns the first substring that matches the regular expression re. If there is no such substring, then the null substring is returned.

Note:
This is used in place of operator()(const RWCRegexp&) and its variants, if you want to use extended regular expressions.
static size_t RWCString::maxWaste ( size_t   )  [inline, static]
Deprecated:
This method is deprecated and is provided only for API compatability. It has no effect on an RWCString instance and may be removed from a future release.
static size_t RWCString::mbLength ( const char *  str,
size_t  nBytes = RW_NPOS 
) [static]

Given a multibyte character sequence, str, and a number of bytes to consider, nBytes, this method calculates the number of multibyte characters in the sequence. If nBytes is RW_NPOS, then the method counts the characters up to, but not including, the first occurrence of a NULL character. The method returns the length, in characters, of the input multibyte sequence if successful. If an error occurs in the conversion, then RW_NPOS is returned.

size_t RWCString::mbLength (  )  const [inline]

Returns the number of multibyte characters in self, according to the Standard C function std::mblen(). Returns RW_NPOS if a bad character is encountered. Note that, in general, mbLength() = length(). Provided only on platforms that provide std::mblen().

bool RWCString::operator!= ( const RWCString str  )  const [inline]

Returns false if self is lexicographically equal to str. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

ConstSubStringType RWCString::operator() ( const RWCRegexp re,
size_t  start 
) 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.

Note:

If you wish to use functionality such as operator()(const RWCRegexp&) with the class RWCRExpr, you must instead use match(const RWTRegularExpression<char>&), or its variants, described below. This is because operator()(const RWCRegexp&) and its variants are ambiguous in the case of RWCString::operator("string") .

Note:
RWCRExpr and RWRegexp are now deprecated in favor of RWTRegex<T> .
This function may be incompatible with strings with embedded nulls. This function is incompatible with MBCS strings.
SubStringType RWCString::operator() ( const RWCRegexp re,
size_t  start 
)

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.

Note:

If you wish to use functionality such as operator()(const RWCRegexp&) with the class RWCRExpr, you must instead use match(const RWTRegularExpression<char>&), or its variants, described below. This is because operator()(const RWCRegexp&) and its variants are ambiguous in the case of RWCString::operator("string") .

Note:
RWCRExpr and RWRegexp are now deprecated in favor of RWTRegex<T> .
This function may be incompatible with strings with embedded nulls. This function is incompatible with MBCS strings.
ConstSubStringType RWCString::operator() ( const RWCRegexp re  )  const

Returns the first substring found that matches the regular expression re. If there is no such substring, then the null substring is returned.

Note:
If you wish to use functionality such as operator()(const RWCRegexp&) with the class RWCRExpr, you must instead use match(const RWTRegularExpression<char>&), or its variants, described below. This is because operator()(const RWCRegexp&) and its variants are ambiguous in the case of RWCString::operator("string") .
RWCRExpr and RWRegexp are now deprecated in favor of RWTRegex<T> .
This function may be incompatible with strings with embedded nulls. This function is incompatible with MBCS strings.
SubStringType RWCString::operator() ( const RWCRegexp re  ) 

Returns the first substring found that matches the regular expression re. If there is no such substring, then the null substring is returned.

Note:
If you wish to use functionality such as operator()(const RWCRegexp&) with the class RWCRExpr, you must instead use match(const RWTRegularExpression<char>&), or its variants, described below. This is because operator()(const RWCRegexp&) and its variants are ambiguous in the case of RWCString::operator("string") .
RWCRExpr and RWRegexp are now deprecated in favor of RWTRegex<T> .
This function may be incompatible with strings with embedded nulls. This function is incompatible with MBCS strings.
RWCConstSubString RWCString::operator() ( size_t  start,
size_t  len 
) const [inline]

Substring operator. Returns a substring of self with length len, starting at index start. The sum of start plus len must be less than or equal to the string length.

Exceptions:
Throws RWBoundsErr if the library was built using the RW_DEBUG flag, and start and len are out of range.
RWCSubString RWCString::operator() ( size_t  start,
size_t  len 
) [inline]

Substring operator. Returns a substring of self with length len, starting at index start. The sum of start plus len must be less than or equal to the string length.

Exceptions:
Throws RWBoundsErr if the library was built using the RW_DEBUG flag, and start and len are out of range.
char RWCString::operator() ( size_t  i  )  const [inline]

Returns the i th character. 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/wstring.h>.

Exceptions:
RWBoundsErr if the index is out of range.

Reimplemented in RWStringID.

char & RWCString::operator() ( size_t  i  )  [inline]

Returns the i th byte. 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/wstring.h>.

Exceptions:
RWBoundsErr if the index is out of range.
RWCString& RWCString::operator+= ( const RWCString str  )  [inline]

Appends the string str to self. Returns a reference to self.

RWCString& RWCString::operator+= ( const std::string  str  )  [inline]

Appends the string str to self. Returns a reference to self.

RWCString& RWCString::operator+= ( const char *  cs  )  [inline]

Appends the null-terminated character string pointed to by cs to self. Returns a reference to self. This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.

bool RWCString::operator< ( const RWCString str  )  const [inline]

Returns true if self is lexicographically before str. Otherwise returns false. Case sensitivity is RWWString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool RWCString::operator<= ( const RWCString str  )  const [inline]

Returns false if self is lexicographically after str. Otherwise returns true. Case sensitivity is RWWString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

RWCString & RWCString::operator= ( const RWCString str  )  [inline]

Assignment operator. The string copies the str values's data. Returns a reference to self.

Reimplemented in RWDBMBString, and RWStringID.

RWCString & RWCString::operator= ( const std::string &  data  )  [inline]

Assignment operator. The string copies the str values's data. Returns a reference to self.

RWCString & RWCString::operator= ( const char *  s  )  [inline]

Assignment operator. Copies the null-terminated character string pointed to by cs into self. Returns a reference to self.

Note:
This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.

Reimplemented in RWDBMBString.

bool RWCString::operator== ( const RWCString str  )  const [inline]

Returns true if self is lexicographically equal to str. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool RWCString::operator> ( const RWCString str  )  const [inline]

Returns true if self is lexicographically after str. Otherwise returns false. Case sensitivity is RWWString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool RWCString::operator>= ( const RWCString str  )  const [inline]

Returns false if self is lexicographically before str. Otherwise returns true. Case sensitivity is RWWString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

char RWCString::operator[] ( unsigned long long  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( long long  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char & RWCString::operator[] ( unsigned long long  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( long long  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char RWCString::operator[] ( unsigned long  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( unsigned int  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( unsigned short  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( long  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( int  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
const

char RWCString::operator[] ( short  i  )  const [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
char & RWCString::operator[] ( unsigned long  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( unsigned int  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( unsigned short  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( long  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( int  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.

char & RWCString::operator[] ( short  i  )  [inline]

Returns the i th byte. The index i must be between 0 and the length of the string less one. Bounds checking is performed.

Exceptions:
RWBoundsErr if the index is out of range.
RWCString & RWCString::prepend ( const RWCString cstr,
size_t  N 
) [inline]

Prepends the first N bytes or the length of cstr (whichever is less) to self. Returns a reference to self.

RWCString & RWCString::prepend ( const std::string &  cstr,
size_t  N 
) [inline]

Prepends the first N bytes or the length of cstr (whichever is less) to self. Returns a reference to self.

RWCString & RWCString::prepend ( const char *  cs,
size_t  N 
) [inline]

Prepends a copy of the character string cs to self. Exactly N bytes 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 & RWCString::prepend ( const std::string &  str  )  [inline]

Prepends a copy of the string str to self. Returns a reference to self.

RWCString & RWCString::prepend ( const char *  cs  )  [inline]

Prepends a copy of the null-terminated character string pointed to by cs to self. Returns a reference to self. This function is incompatible with cs strings with embedded nulls and may be incompatible with cs MBCS strings.

RWCString & RWCString::prepend ( char  c,
size_t  N = 1 
) [inline]

Prepends N copies of character c to self. Returns a reference to self.

std::istream& RWCString::readFile ( std::istream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until EOF is reached. Null characters are treated the same as other characters.

std::istream& RWCString::readLine ( std::istream &  s,
bool  skipWhite = true 
)

Reads characters from the input stream s, replacing the previous contents of self, until a newline (or an EOF) is encountered. The newline is removed from the input stream but is not stored. Null characters are treated the same as other characters. If the skipWhite argument is true, then white space is skipped (using the iostream library manipulator ws) before saving characters.

std::istream& RWCString::readString ( std::istream &  s  ) 

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or null terminator is encountered. If the number of bytes remaining in the stream is large, you should resize the RWCString to approximately the number of bytes to be read prior to using this method. See "String Processing Classes" in the Essential Tools Module User's Guide for more information. This function is incompatible with strings with embedded nulls and may be incompatible with MBCS strings.

std::istream& RWCString::readToDelim ( std::istream &  s,
char  delim = '\n' 
)

Reads characters from the input stream s, replacing the previous contents of self, until an EOF or the delimiting character delim is encountered. The delimiter is removed from the input stream but is not stored. Null characters are treated the same as other characters. If delim is '\0' then this function is incompatible with strings with embedded nulls. If delim is '\0' then this function may be incompatible with MBCS strings.

std::istream& RWCString::readToken ( std::istream &  s  ) 

White space is skipped before saving characters. Characters are then read from the input stream s, replacing previous contents of self, until trailing white space or an EOF is encountered. The white space is left on the input stream. Null characters are treated the same as other characters. White space is identified by the Standard C Library function isspace(). This function is incompatible with MBCS strings.

RWCString & RWCString::remove ( size_t  pos,
size_t  N 
) [inline]

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 & RWCString::remove ( size_t  pos  )  [inline]

Removes the bytes from the byte position pos, which must be no greater than length(), to the end of string. Returns a reference to self.

RWCString& RWCString::replace ( const RWTRegularExpression< char > &  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(RWTRegularExpression<char>("(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.

RWCString& RWCString::replace ( const RWTRegularExpression< char > &  pattern,
const char *  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(RWTRegularExpression<char>("(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.

RWCString & RWCString::replace ( size_t  pos,
size_t  N1,
const std::string &  str,
size_t  N2 
) [inline]

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.

RWCString & RWCString::replace ( size_t  pos,
size_t  N1,
const RWCString str,
size_t  N2 
) [inline]

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.

RWCString & RWCString::replace ( size_t  pos,
size_t  N1,
const char *  cs,
size_t  N2 
) [inline]

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 & RWCString::replace ( size_t  pos,
size_t  N,
const RWCString str 
) [inline]

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 & RWCString::replace ( size_t  pos,
size_t  N,
const std::string &  str 
) [inline]

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 & RWCString::replace ( size_t  pos,
size_t  N,
const char *  cs 
) [inline]

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 and may be incompatible with cs MBCS strings.

void RWCString::resize ( size_t  N  )  [inline]

Changes the length of self to N bytes, adding blanks or truncating as necessary.

static size_t RWCString::resizeIncrement ( size_t  n = 16  )  [inline, static]
Deprecated:
This method is deprecated and is provided only for API compatability. It has no effect on an RWCString instance and may be removed from a future release.
size_t RWCString::rindex ( const RWCString pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of the first patlen characters from pat that start on or before index i and are closest to the end of self. If there is a match, returns the index of the start of the match; otherwise returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const std::string &  pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of the first patlen characters from pat that start on or before index i and are closest to the end of self. If there is a match, returns the index of the start of the match; otherwise returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const char *  pat,
size_t  patlen,
size_t  i,
caseCompare  cmp 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of the first patlen characters from pat that start on or before index i and are closest to the end of self. If there is a match, returns the index of the start of the match; otherwise returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const RWCString pat,
size_t  i = RW_NPOS,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of pat that starts on or before index i and is closest to the end of self. If there is a pattern match, returns the index of the start of the match; otherwise, returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const std::string &  pat,
size_t  i = RW_NPOS,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of pat that starts on or before index i and is closest to the end of self. If there is a pattern match, returns the index of the start of the match; otherwise, returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const char *  pat,
size_t  i = RW_NPOS,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of pat that starts on or before index i and is closest to the end of self. If there is a pattern match, returns the index of the start of the match; otherwise, returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const char  pat,
size_t  i = RW_NPOS,
caseCompare  cmp = exact 
) const [inline]

Pattern matching. Starting with index i, searches for the occurrence of pat that starts on or before index i and is closest to the end of self. If there is a pattern match, returns the index of the start of the match; otherwise, returns RW_NPOS. Case sensitivity is according to the caseCompare argument, which defaults to RWCString::exact.

size_t RWCString::rindex ( const char *  pat,
caseCompare  cmp 
) const [inline]

Pattern matching function that starts at the rear of the string and searches for the first occurrence of pat closest to the end of the string. Returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to the caseCompare argument.

std::string& RWCString::std (  ) 

Returns a const reference to the underlying implementation of std::string.

ConstSubStringType RWCString::strip ( stripType  s = trailing,
char  c = static_cast< char >( ' ') 
) const

Returns a substring of self where the character c has been stripped off the beginning, end, or both ends of the string.

SubStringType RWCString::strip ( stripType  s = trailing,
char  c = static_cast< char >( ' ') 
)

Returns a substring of self where the character c has been stripped off the beginning, end, or both ends of the string.

ConstSubStringType RWCString::subString ( const char *  cs,
size_t  start = 0,
caseCompare  cmp = exact 
) const

Returns a substring representing the first occurrence of the null-terminated string pointed to by cs.Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::ignoreCase then this function is incompatible with MBCS strings. This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.

SubStringType RWCString::subString ( const char *  cs,
size_t  start = 0,
caseCompare  cmp = exact 
)

Returns a substring representing the first occurrence of the null-terminated string pointed to by cs.

Case sensitivity is according to the caseCompare argument; it defaults to RWCString::exact. If caseCompare is RWCString::ignoreCase then this function is incompatible with MBCS strings. This function is incompatible with cs strings with embedded nulls. This function may be incompatible with cs MBCS strings.

void RWCString::toLower (  )  [inline]

Changes all upper-case letters in self to lower-case, using the Standard C Library facilities declared in <ctype.h>. This function is incompatible with MBCS strings.

void RWCString::toUpper (  )  [inline]

Changes all lower-case letters in self to upper-case, using the Standard C Library facilities declared in <ctype.h>. This function is incompatible with MBCS strings.


Friends And Related Function Documentation

bool operator!= ( char  c,
const RWCString str 
) [related]

Returns false if the RWCString str is not of length one, or the first character of the RWCString str is not identical to the char c specified.

bool operator!= ( const RWCString str,
char  c 
) [related]

Returns false if the RWCString str is not of length one, or the first character of the RWCString str is not identical to the char c specified.

bool operator!= ( const std::string &  s1,
const RWCString s2 
) [related]

Returns false if s1 and s2 are lexicographically equal. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator!= ( const RWCString s1,
const std::string &  s2 
) [related]

Returns false if s1 and s2 are lexicographically equal. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator!= ( const char *  s1,
const RWCString s2 
) [related]

Returns false if s1 and s2 are lexicographically equal. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This functionis incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator!= ( const RWCString s1,
const char *  s2 
) [related]

Returns false if s1 and s2 are lexicographically equal. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This functionis incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
RWCString operator+ ( const std::string &  str1,
const RWCString str2 
) [friend]

Concatenation operator.

RWCString operator+ ( const RWCString str1,
const std::string &  str2 
) [friend]

Concatenation operator.

RWCString operator+ ( const char *  s,
const RWCString str 
) [friend]

Concatenation operator.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

RWCString operator+ ( const RWCString str,
const char *  s 
) [friend]

Concatenation operator.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
RWCString operator+ ( const RWCString str1,
const RWCString str2 
) [friend]

Concatenation operator.

bool operator< ( char  c,
const RWCString str 
) [related]

Returns false if the char c is greater than the first char of RWCString str. Returns true if the first char of RWCString str is greater than the char c.

bool operator< ( const RWCString str,
char  c 
) [related]

Returns false if the first char of RWCString str is greater than the char c. Returns true if the first char of RWCString str is less than the char c or str is an empty string.

bool operator< ( const std::string &  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator< ( const RWCString s1,
const std::string &  s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator< ( const char *  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator< ( const RWCString s1,
const char *  s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
RWFile & operator<< ( RWFile file,
const RWCString str 
) [related]

Saves string str to an RWFile.

RWvostream & operator<< ( RWvostream vos,
const RWCString str 
) [related]

Saves string str to a virtual stream.

std::ostream & operator<< ( std::ostream &  os,
const RWCString str 
) [related]

Output an RWCString on std::ostream os.

bool operator<= ( char  c,
const RWCString str 
) [related]

Returns false if the char c is greater than the first char of RWCString str. Returns true if the first char of RWCString str is greater than the char c, or str and c are equal.

bool operator<= ( const RWCString str,
char  c 
) [related]

Returns false if the first char of RWCString str is greater than the char c. Returns true if the first char of RWCString str is less than the char c, or str and c are equal.

bool operator<= ( const std::string &  s1,
const RWCString s2 
) [related]

Returns false if s1 is lexicographically after s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator<= ( const RWCString s1,
const std::string &  s2 
) [related]

Returns false if s1 is lexicographically after s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator<= ( const char *  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator<= ( const RWCString s1,
const char *  s2 
) [related]

Returns false if s1 is lexicographically after s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
bool operator== ( char  c,
const RWCString str 
) [related]

Returns true if the RWCString str is of length one and the first character of the RWCString str is identical to the char c specified.

bool operator== ( const RWCString str,
char  c 
) [related]

Returns true if the RWCString str is of length one and the first character of the RWCString str is identical to the char c specified.

bool operator== ( const std::string &  s1,
const RWCString s2 
) [related]

Returns true if s1 and s2 are lexicographically equal. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator== ( const RWCString s1,
const std::string &  s2 
) [related]

Returns true if s1 and s2 are lexicographically equal. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator== ( const char *  s1,
const RWCString s2 
) [related]

Returns true if s1 and s2 are lexicographically equal. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This functionis incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator== ( const RWCString s1,
const char *  s2 
) [related]

Returns true if s1 and s2 are lexicographically equal. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This functionis incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
bool operator> ( char  c,
const RWCString str 
) [related]

Returns true if the char c is greater than first char of RWCString str. Returns false if the char c is less than first char of RWCString str.

bool operator> ( const RWCString str,
char  c 
) [related]

Returns true if the first char of RWCString str is greater than char c. Returns false if the first char of RWCString str is less than char c.

bool operator> ( const std::string &  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator> ( const RWCString s1,
const std::string &  s2 
) [related]

Returns true if s1 is lexicographically after s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator> ( const char *  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically after s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator> ( const RWCString s1,
const char *  s2 
) [related]

Returns true if s1 is lexicographically after s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
bool operator>= ( char  c,
const RWCString str 
) [related]

Returns true if the char c is greater than first char of RWCString str or c is equal to the first char of str. Returns false if the char c is less than first char of RWCString str.

bool operator>= ( const RWCString str,
char  c 
) [related]

Returns true if the char c is greater than first char of RWCString str or c is equal to the first char of str. Returns false if the char c is less than first char of RWCString str.

bool operator>= ( const std::string &  s1,
const RWCString s2 
) [related]

Returns false if s1 is lexicographically before s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator>= ( const RWCString s1,
const std::string &  s2 
) [related]

Returns false if s1 is lexicographically before s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

bool operator>= ( const char *  s1,
const RWCString s2 
) [related]

Returns true if s1 is lexicographically before s2. Otherwise returns false. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.

bool operator>= ( const RWCString s1,
const char *  s2 
) [related]

Returns false if s1 is lexicographically before s2. Otherwise returns true. Case sensitivity is RWCString::exact. Use member RWCString::collate() or RWCString::strXForm() for locale sensitivity.

Note:
This function is incompatible with const char* strings with embedded nulls and may be incompatible with const char* MBCS strings.
RWFile & operator>> ( RWFile file,
RWCString str 
) [related]

Restores a string into str from an RWFile, replacing the previous contents of str. If the file produces an error on extraction, the operator returns the original string contents unmodified. Be sure to check the file to determine if an extraction error occurred.

RWvistream & operator>> ( RWvistream vis,
RWCString str 
) [related]

Restores a string into str from a virtual stream, replacing the previous contents of str. If the virtual stream produces an error on extraction, the operator returns the original string contents unmodified. Be sure to check the virtual stream to determine if an extraction error occurred.

std::istream & operator>> ( std::istream &  is,
RWCString str 
) [related]

Calls RWCString::readToken(std::istream&). That is, a token is read from the input stream is. This function is incompatible with MBCS strings.

RWCString strXForm ( const std::string &  str  )  [related]

Returns the result of applying strxfrm() to the argument string, to allow quicker collation than RWCString::collate(). Provided only on platforms that provide strxfrm(). This function is incompatible with strings with embedded nulls.

RWCString toLower ( const RWCString str  )  [related]

Returns a version of str where all upper-case characters have been replaced with lower-case characters. Uses the Standard C Library function tolower(). This function is incompatible with MBCS strings.

RWCString toUpper ( const RWCString str  )  [related]

Returns a version of str where all lower-case characters have been replaced with upper-case characters. Uses the Standard C Library function toupper(). This function is incompatible with MBCS strings.


© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, 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.