SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

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

#include <rw/cstring.h>

Inheritance diagram for RWCString:
RWCollectableString RWDBMBString RWStringID

Public Types

enum  caseCompare { exact , ignoreCase , ignoreCaseStrict }
 
typedef RWCConstSubString ConstSubString
 
enum  scopeType { one , all }
 
enum  stripType { leading , trailing , both }
 
typedef RWCSubString SubString
 

Public Member Functions

 RWCString ()
 
 RWCString (char c)
 
 RWCString (char c, size_t count)
 
 RWCString (const char *str)
 
 RWCString (const char *str, size_t len)
 
 RWCString (const ConstSubString &str)
 
 RWCString (const RWCString &str)
 
 RWCString (const std::string &str)
 
 RWCString (const SubString &str)
 
 RWCString (RWCString &&str)
 
 RWCString (RWSize_T cap)
 
 RWCString (signed char c)
 
 RWCString (unsigned char c)
 
RWCStringappend (char c, size_t count=1)
 
RWCStringappend (const char *str)
 
RWCStringappend (const char *str, size_t len)
 
RWCStringappend (const ConstSubString &str)
 
RWCStringappend (const RWCString &str)
 
RWCStringappend (const RWCString &str, size_t len)
 
RWCStringappend (const std::string &str)
 
RWCStringappend (const std::string &str, size_t len)
 
RWCStringappend (const SubString &str)
 
RWCStringassign (char c, size_t count=1)
 
RWCStringassign (const char *str)
 
RWCStringassign (const char *str, size_t len)
 
RWCStringassign (const ConstSubString &str)
 
RWCStringassign (const RWCString &str)
 
RWCStringassign (const std::string &str)
 
RWCStringassign (const SubString &str)
 
RWspace binaryStoreSize () const
 
size_t capacity () const
 
size_t capacity (size_t cap)
 
int collate (const char *str) const
 
int collate (const RWCString &str) const
 
int collate (const std::string &str) const
 
int compareTo (const char *str, caseCompare cmp=exact) const
 
int compareTo (const char *str, size_t len, caseCompare cmp=exact) const
 
int compareTo (const ConstSubString &str, caseCompare cmp=exact) const
 
int compareTo (const RWCString &str, caseCompare cmp=exact) const
 
int compareTo (const RWCString *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 SubString &str, caseCompare cmp=exact) const
 
bool contains (const char *str, caseCompare cmp=exact) const
 
bool contains (const char *str, size_t len, caseCompare cmp=exact) const
 
bool contains (const ConstSubString &str, caseCompare cmp=exact) const
 
bool contains (const RWCString &str, caseCompare cmp=exact) const
 
bool contains (const std::string &str, caseCompare cmp=exact) const
 
bool contains (const SubString &str, caseCompare cmp=exact) const
 
const char * data () const
 
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 len) const
 
size_t firstNotOf (char c, size_t pos=0) const
 
size_t firstNotOf (const char *str, size_t pos, size_t len) const
 
size_t firstNotOf (const char *str, size_t pos=0) const
 
size_t firstNotOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstNotOf (const RWCString &str, size_t pos=0) const
 
size_t firstNotOf (const std::string &str, size_t pos=0) const
 
size_t firstNotOf (const SubString &str, size_t pos=0) const
 
size_t firstOf (char c, size_t pos=0) const
 
size_t firstOf (const char *str, size_t pos, size_t len) const
 
size_t firstOf (const char *str, size_t pos=0) const
 
size_t firstOf (const ConstSubString &str, size_t pos=0) const
 
size_t firstOf (const RWCString &str, size_t pos=0) const
 
size_t firstOf (const std::string &str, size_t pos=0) const
 
size_t firstOf (const SubString &str, size_t pos=0) const
 
unsigned hash (caseCompare cmp=exact) const
 
size_t index (const char *pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const char *pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const char *re, size_t *ext, size_t start=0) const
 
size_t index (const char pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const ConstSubString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const RWCRegexp &re, size_t *ext, size_t start=0) const
 
size_t index (const RWCRegexp &re, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t *ext, size_t start=0) const
 
size_t index (const RWCRExpr &re, size_t start=0) const
 
size_t index (const RWCString &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const RWCString &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const std::string &pat, size_t patlen, size_t start, caseCompare cmp) const
 
size_t index (const std::string &pat, size_t start=0, caseCompare cmp=exact) const
 
size_t index (const SubString &pat, size_t start=0, caseCompare cmp=exact) const
 
RWCStringinsert (size_t pos, char c, size_t count)
 
RWCStringinsert (size_t pos, const char *str)
 
RWCStringinsert (size_t pos, const char *str, size_t len)
 
RWCStringinsert (size_t pos, const ConstSubString &str)
 
RWCStringinsert (size_t pos, const RWCString &str)
 
RWCStringinsert (size_t pos, const RWCString &str, size_t len)
 
RWCStringinsert (size_t pos, const std::string &str)
 
RWCStringinsert (size_t pos, const std::string &str, size_t len)
 
RWCStringinsert (size_t pos, const SubString &str)
 
bool isAscii () const
 
bool isNull () const
 
size_t last (char c) const
 
size_t last (char c, size_t) const
 
size_t last (const char *str) const
 
size_t last (const char *str, size_t len) const
 
size_t lastNotOf (char c, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const char *str, size_t pos, size_t len) const
 
size_t lastNotOf (const char *str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const std::string &str, size_t pos=RW_NPOS) const
 
size_t lastNotOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (char c, size_t pos=RW_NPOS) const
 
size_t lastOf (const char *str, size_t pos, size_t len) const
 
size_t lastOf (const char *str, size_t pos=RW_NPOS) const
 
size_t lastOf (const ConstSubString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const RWCString &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const std::string &str, size_t pos=RW_NPOS) const
 
size_t lastOf (const SubString &str, size_t pos=RW_NPOS) const
 
size_t length () const
 
ConstSubString match (const RWCRExpr &) const
 
SubString match (const RWCRExpr &re)
 
SubString match (const RWCRExpr &re, size_t start)
 
ConstSubString match (const RWCRExpr &re, size_t start) const
 
size_t mbLength () const
 
 operator const char * () const
 
SubString operator() (const RWCRegexp &re)
 
ConstSubString operator() (const RWCRegexp &re) const
 
SubString operator() (const RWCRegexp &re, size_t start)
 
ConstSubString operator() (const RWCRegexp &re, size_t start) const
 
char & operator() (size_t i)
 
char operator() (size_t i) const
 
SubString operator() (size_t start, size_t len)
 
ConstSubString operator() (size_t start, size_t len) const
 
RWCStringoperator+= (char c)
 
RWCStringoperator+= (const char *str)
 
RWCStringoperator+= (const ConstSubString &str)
 
RWCStringoperator+= (const RWCString &str)
 
RWCStringoperator+= (const std::string &str)
 
RWCStringoperator+= (const SubString &str)
 
RWCStringoperator= (char c)
 
RWCStringoperator= (const char *str)
 
RWCStringoperator= (const ConstSubString &str)
 
RWCStringoperator= (const RWCString &str)
 
RWCStringoperator= (const std::string &str)
 
RWCStringoperator= (const SubString &str)
 
RWCStringoperator= (RWCString &&str)
 
char & operator[] (char i)
 
char operator[] (char i) const
 
char & operator[] (int i)
 
char operator[] (int i) const
 
char & operator[] (long i)
 
char operator[] (long i) const
 
char & operator[] (long long i)
 
char operator[] (long long i) const
 
char & operator[] (short i)
 
char operator[] (short i) const
 
char & operator[] (signed char i)
 
char operator[] (signed char i) const
 
char & operator[] (unsigned char i)
 
char operator[] (unsigned char i) const
 
char & operator[] (unsigned int i)
 
char operator[] (unsigned int i) const
 
char & operator[] (unsigned long i)
 
char operator[] (unsigned long i) const
 
char & operator[] (unsigned long long i)
 
char operator[] (unsigned long long i) const
 
char & operator[] (unsigned short i)
 
char operator[] (unsigned short i) const
 
RWCStringprepend (char c, size_t count=1)
 
RWCStringprepend (const char *str)
 
RWCStringprepend (const char *str, size_t len)
 
RWCStringprepend (const ConstSubString &str)
 
RWCStringprepend (const RWCString &str)
 
RWCStringprepend (const RWCString &str, size_t len)
 
RWCStringprepend (const std::string &str)
 
RWCStringprepend (const std::string &str, size_t len)
 
RWCStringprepend (const SubString &str)
 
std::istream & readFile (std::istream &strm)
 
std::istream & readLine (std::istream &strm, bool skipWhite=true)
 
std::istream & readString (std::istream &strm)
 
std::istream & readToDelim (std::istream &strm, char delim='\n')
 
std::istream & readToken (std::istream &strm)
 
RWCStringremove (size_t pos)
 
RWCStringremove (size_t pos, size_t len)
 
RWCStringreplace (const RWCRExpr &re, const char *str, scopeType scope=one)
 
RWCStringreplace (const RWCRExpr &re, const RWCString &str, scopeType scope=one)
 
RWCStringreplace (size_t pos, size_t len, const char *str)
 
RWCStringreplace (size_t pos, size_t len, const char *str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const ConstSubString &str)
 
RWCStringreplace (size_t pos, size_t len, const RWCString &str)
 
RWCStringreplace (size_t pos, size_t len, const RWCString &str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const std::string &str)
 
RWCStringreplace (size_t pos, size_t len, const std::string &str, size_t strLen)
 
RWCStringreplace (size_t pos, size_t len, const SubString &str)
 
void resize (size_t len)
 
size_t rindex (const char *pat, caseCompare cmp) const
 
size_t rindex (const char *pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const char *pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const char pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const ConstSubString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWCString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const RWCString &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const std::string &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
size_t rindex (const std::string &pat, size_t patlen, size_t end, caseCompare cmp) const
 
size_t rindex (const SubString &pat, size_t end=RW_NPOS, caseCompare cmp=exact) const
 
void shrink ()
 
std::string & std ()
 
const std::string & std () const
 
SubString strip (stripType st=trailing, char c=' ')
 
ConstSubString strip (stripType st=trailing, char c=' ') const
 
SubString subString (const char *pat, size_t start=0, caseCompare cmp=exact)
 
ConstSubString subString (const char *pat, size_t start=0, caseCompare cmp=exact) const
 
void swap (RWCString &str)
 
void toLower ()
 
void toUpper ()
 

Static Public Member Functions

static size_t byteCount (const char *str, size_t nChars=RW_NPOS)
 
static unsigned hash (const RWCString &str)
 
static size_t mbLength (const char *str, size_t nBytes=RW_NPOS)
 

Friends

class RWCConstSubString
 
class RWCSubString
 
class RWCTokenizer
 

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

Class RWCString offers powerful and convenient facilities for manipulating strings.

Note
RWCString is designed for use with single or 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:

  • Because characters can be more than one byte long, the number of bytes in a string can, in general, be greater than the number of characters in the string. Use function RWCString::length() to get the number of bytes in a string, and function RWCString::mbLength() to get the number of characters. Note that the latter is much slower because it must determine the number of bytes in every character. Hence, if the string is known to use a SBCS, then RWCString::length() is preferred.
  • One or more bytes of a multibyte character can be zero. Hence, MBCS cannot be counted on being null-terminated. In practice, it is a rare MBCS that uses embedded nulls. Nevertheless, you should be aware of this and program defensively. In any case, class RWCString can handle embedded nulls.

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>
Offers powerful and convenient facilities for manipulating strings.
Definition stdcstring.h:826
Persistence
Simple
Example
#include <rw/cstring.h>
#include <iostream>
int main() {
RWCString a("There is no joy in Beantown.");
std::cout << "\"" << a << "\""
<< " becomes ";
a.subString("Beantown") = "Redmond";
std::cout << "\"" << a << "\"" << std::endl;
return 0;
}
SubString subString(const char *pat, size_t start=0, caseCompare cmp=exact)
Definition stdcstring.h:6236

Program output:

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

Member Typedef Documentation

◆ ConstSubString

The immutable substring class associated with RWCString.

◆ SubString

The mutable substring class associated with RWCString.

Member Enumeration Documentation

◆ caseCompare

Specifies semantics used by comparisons, searches, and hashing functions

Enumerator
exact 

Use exact case sensitive semantics

ignoreCase 

Ignore case sensitive semantics

ignoreCaseStrict 

Case-insensitive for alpha characters only. ignoreCaseStrict only differs from ignoreCase in comparison operations, where changing case can affect the order of the strings.

◆ scopeType

Deprecated
As of SourcePro 12, provided for compatibility with code that relies on the enumeration RWCString::scopeType.

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

Enumerator
one 

replaces first substring matched.

all 

replaces all substrings matched.

◆ stripType

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() [1/13]

RWCString::RWCString ( )
inline

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

◆ RWCString() [2/13]

RWCString::RWCString ( const RWCString & str)
inline

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

◆ RWCString() [3/13]

RWCString::RWCString ( RWCString && str)
inline

Move constructor. The created string takes ownership of the data owned by str.

Condition:
This method is available only on platforms with rvalue reference support.

◆ RWCString() [4/13]

RWCString::RWCString ( const SubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ RWCString() [5/13]

RWCString::RWCString ( const ConstSubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ RWCString() [6/13]

RWCString::RWCString ( const std::string & str)
inline

Constructs a string with data copied from str.

◆ RWCString() [7/13]

RWCString::RWCString ( const char * str)
inline

Converts from the null-terminated character string str. The created string copies the data pointed to by str, up to the first terminating null.

Note
This function is incompatible with str strings with embedded nulls.

◆ RWCString() [8/13]

RWCString::RWCString ( const char * str,
size_t len )
inline

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

◆ RWCString() [9/13]

RWCString::RWCString ( char c)
inline

Constructs a string containing the single character c.

◆ RWCString() [10/13]

RWCString::RWCString ( signed char c)
inline

Constructs a string containing the single signed character c.

◆ RWCString() [11/13]

RWCString::RWCString ( unsigned char c)
inline

Constructs a string containing the single unsigned character c.

◆ RWCString() [12/13]

RWCString::RWCString ( char c,
size_t count )
inline

Constructs a string containing the character c repeated count times.

◆ RWCString() [13/13]

RWCString::RWCString ( RWSize_T cap)
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 cap. 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

◆ append() [1/9]

RWCString & RWCString::append ( char c,
size_t count = 1 )
inline

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

◆ append() [2/9]

RWCString & RWCString::append ( const char * str)
inline

Appends a copy of the null-terminated character string pointed to by str to self. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.

◆ append() [3/9]

RWCString & RWCString::append ( const char * str,
size_t len )
inline

Appends a copy of the character string str to self. Exactly len bytes are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len bytes long. Returns a reference to self.

◆ append() [4/9]

RWCString & RWCString::append ( const ConstSubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ append() [5/9]

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

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

◆ append() [6/9]

RWCString & RWCString::append ( const RWCString & str,
size_t len )
inline

Appends the first len bytes of str to self. If len is greater than the length of str, the entire string is appended. Returns a reference to self.

◆ append() [7/9]

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

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

◆ append() [8/9]

RWCString & RWCString::append ( const std::string & str,
size_t len )
inline

Appends the first len bytes of str to self. If len is greater than the length of str, the entire string is appended. Returns a reference to self.

◆ append() [9/9]

RWCString & RWCString::append ( const SubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ assign() [1/7]

RWCString & RWCString::assign ( char c,
size_t count = 1 )
inline

Assigns count copies of the character c to self, replacing existing content. Returns a reference to self.

◆ assign() [2/7]

RWCString & RWCString::assign ( const char * str)
inline

Assigns the null-terminated string pointed to by str to self, replacing existing content. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.

◆ assign() [3/7]

RWCString & RWCString::assign ( const char * str,
size_t len )
inline

Assigns a copy of the character string str to self, replacing existing content. Exactly len bytes are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len bytes long. Returns a reference to self.

◆ assign() [4/7]

RWCString & RWCString::assign ( const ConstSubString & str)
inline

Assigns a copy of the string str to self, replacing existing content. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.

◆ assign() [5/7]

RWCString & RWCString::assign ( const RWCString & str)
inline

Assigns a copy of the string str to self, replacing existing content. Returns a reference to self.

◆ assign() [6/7]

RWCString & RWCString::assign ( const std::string & str)
inline

Assigns a copy of the string str to self, replacing existing content. Returns a reference to self.

◆ assign() [7/7]

RWCString & RWCString::assign ( const SubString & str)
inline

Assigns a copy of the string str to self, replacing existing content. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.

◆ binaryStoreSize()

RWspace RWCString::binaryStoreSize ( ) const
inline

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

RWFile & operator<<(RWFile &file, const RWCString &str)
Represents an abstraction of a filesystem regular file.
Definition rwfile.h:68
Abstract base class that provides an interface for format-dependent storage of fundamental types and ...
Definition vstream.h:749

◆ byteCount()

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, RW_NPOS is returned.

◆ capacity() [1/2]

size_t RWCString::capacity ( ) const
inline

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

◆ capacity() [2/2]

size_t RWCString::capacity ( size_t cap)
inline

A non-binding request to alter the capacity of self to cap. The capacity is never reduced below the current number of bytes. Returns the actual capacity.

◆ collate() [1/3]

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 C++ Standard Library function std::strcoll() on self and the argument str. This supports locale-dependent collation.

Note
This function is incompatible with strings with embedded nulls.

◆ collate() [2/3]

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 C++ Standard Library function std::strcoll() on self and the argument str. This supports locale-dependent collation.

Note
This function is incompatible with strings with embedded nulls.

◆ collate() [3/3]

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 C++ Standard Library function std::strcoll() on self and the argument str. This supports locale-dependent collation.

Note
This function is incompatible with strings with embedded nulls.

◆ compareTo() [1/8]

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

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.
This function is incompatible with str strings with embedded nulls.

◆ compareTo() [2/8]

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

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.

◆ compareTo() [3/8]

int RWCString::compareTo ( const ConstSubString & str,
caseCompare cmp = exact ) const
inline

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ compareTo() [4/8]

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

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.

◆ compareTo() [5/8]

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

This function is the equivalent of calling:

int compareTo(const RWCString &str, caseCompare cmp=exact) const
Definition stdcstring.h:4362

◆ compareTo() [6/8]

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

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.

◆ compareTo() [7/8]

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

This function is the equivalent of calling:

◆ compareTo() [8/8]

int RWCString::compareTo ( const SubString & str,
caseCompare cmp = exact ) const
inline

Lexicographically compares self to str. Returns the following values based on the results of the comparison:

<0 self precedes str.
0 self is equal to str.
>0 self follows str.

If cmp is either RWCString::ignoreCase or RWCString::ignoreCaseStrict, the strings are normalized before they are compared.

Note
If cmp is not RWCString::exact, this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ contains() [1/6]

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

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

◆ contains() [2/6]

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

Returns false if RWCString::index(str, len, cmp) returns RW_NPOS, otherwise returns true.

◆ contains() [3/6]

bool RWCString::contains ( const ConstSubString & str,
caseCompare cmp = exact ) const
inline

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

Note
Behavior is undefined if str is a null substring.

◆ contains() [4/6]

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

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

◆ contains() [5/6]

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

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

◆ contains() [6/6]

bool RWCString::contains ( const SubString & str,
caseCompare cmp = exact ) const
inline

Returns false if RWCString::index(str, cmp) returns RW_NPOS, otherwise returns true.

Note
Behavior is undefined if str is a null substring.

◆ data()

const char * RWCString::data ( ) const
inline

Provides access to the RWCString instances'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, its length is still given by the member function length(). That is, it may contain embedded nulls.

◆ first() [1/4]

size_t RWCString::first ( char c) const
inline
Deprecated
As of SourcePro 12, use RWCString::firstOf(char, size_t) const instead.

◆ first() [2/4]

size_t RWCString::first ( char c,
size_t  ) const
inline
Deprecated
As of SourcePro 12, use RWCString::firstOf(char, size_t) const instead.

◆ first() [3/4]

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

◆ first() [4/4]

size_t RWCString::first ( const char * str,
size_t len ) const
inline

◆ firstNotOf() [1/7]

size_t RWCString::firstNotOf ( char c,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence of a character in self that is not c, starting at position pos. Returns RW_NPOS if there is no match.

◆ firstNotOf() [2/7]

size_t RWCString::firstNotOf ( const char * str,
size_t pos,
size_t len ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in the first len bytes of str. Returns RW_NPOS if there is no match.

◆ firstNotOf() [3/7]

size_t RWCString::firstNotOf ( const char * str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in the null-terminated string str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.

◆ firstNotOf() [4/7]

size_t RWCString::firstNotOf ( const ConstSubString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ firstNotOf() [5/7]

size_t RWCString::firstNotOf ( const RWCString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in str. Returns RW_NPOS if there is no match.

◆ firstNotOf() [6/7]

size_t RWCString::firstNotOf ( const std::string & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in str. Returns RW_NPOS if there is no match.

◆ firstNotOf() [7/7]

size_t RWCString::firstNotOf ( const SubString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character not in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ firstOf() [1/7]

size_t RWCString::firstOf ( char c,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence of the character c in self, starting at position pos. Returns RW_NPOS if there is no match.

◆ firstOf() [2/7]

size_t RWCString::firstOf ( const char * str,
size_t pos,
size_t len ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in the first len bytes of str. Returns RW_NPOS if there is no match.

◆ firstOf() [3/7]

size_t RWCString::firstOf ( const char * str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in the null-terminated string str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.

◆ firstOf() [4/7]

size_t RWCString::firstOf ( const ConstSubString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ firstOf() [5/7]

size_t RWCString::firstOf ( const RWCString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in str. Returns RW_NPOS if there is no match.

◆ firstOf() [6/7]

size_t RWCString::firstOf ( const std::string & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in str. Returns RW_NPOS if there is no match.

◆ firstOf() [7/7]

size_t RWCString::firstOf ( const SubString & str,
size_t pos = 0 ) const
inline

Returns the index of the first occurrence in self, starting at position pos, of any character in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ hash() [1/2]

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

Returns a suitable hash value.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ hash() [2/2]

unsigned RWCString::hash ( const RWCString & str)
inlinestatic

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

◆ index() [1/14]

size_t RWCString::index ( const char * pat,
size_t patlen,
size_t start,
caseCompare cmp ) const
inline

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [2/14]

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

Pattern matching. Starting with index start, searches for the first occurrence of the null-terminated string 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 cmp.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [3/14]

size_t RWCString::index ( const char * re,
size_t * ext,
size_t start = 0 ) const
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [4/14]

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

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [5/14]

size_t RWCString::index ( const ConstSubString & pat,
size_t start = 0,
caseCompare cmp = exact ) const
inline

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ index() [6/14]

size_t RWCString::index ( const RWCRegexp & re,
size_t * ext,
size_t start = 0 ) const
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [7/14]

size_t RWCString::index ( const RWCRegexp & re,
size_t start = 0 ) const
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [8/14]

size_t RWCString::index ( const RWCRExpr & re,
size_t * ext,
size_t start = 0 ) const
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [9/14]

size_t RWCString::index ( const RWCRExpr & re,
size_t start = 0 ) const
Deprecated
As of SourcePro 12, use RWTRegex::index instead.

◆ index() [10/14]

size_t RWCString::index ( const RWCString & pat,
size_t patlen,
size_t start,
caseCompare cmp ) const
inline

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [11/14]

size_t RWCString::index ( const RWCString & pat,
size_t start = 0,
caseCompare cmp = exact ) const
inline

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [12/14]

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

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [13/14]

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

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ index() [14/14]

size_t RWCString::index ( const SubString & pat,
size_t start = 0,
caseCompare cmp = exact ) const
inline

Pattern matching. Starting with index start, 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 cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ insert() [1/9]

RWCString & RWCString::insert ( size_t pos,
char c,
size_t count )
inline

Inserts count instances of the character c into self at byte position pos. Returns a reference to self.

◆ insert() [2/9]

RWCString & RWCString::insert ( size_t pos,
const char * str )
inline

Inserts a copy of the null-terminated string str into self at index pos. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.

◆ insert() [3/9]

RWCString & RWCString::insert ( size_t pos,
const char * str,
size_t len )
inline

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

◆ insert() [4/9]

RWCString & RWCString::insert ( size_t pos,
const ConstSubString & str )
inline

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

Note
Behavior is undefined if str is a null substring.

◆ insert() [5/9]

RWCString & RWCString::insert ( size_t pos,
const RWCString & str )
inline

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

◆ insert() [6/9]

RWCString & RWCString::insert ( size_t pos,
const RWCString & str,
size_t len )
inline

Inserts the first len bytes of str into self at index pos. If len is greater than the length of str, the entire string is inserted. Returns a reference to self.

◆ insert() [7/9]

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

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

◆ insert() [8/9]

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

Inserts the first len bytes of str into self at index pos. If len is greater than the length of str, the entire string is inserted. Returns a reference to self.

◆ insert() [9/9]

RWCString & RWCString::insert ( size_t pos,
const SubString & str )
inline

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

Note
Behavior is undefined if str is a null substring.

◆ isAscii()

bool RWCString::isAscii ( ) const

Returns true if all bytes in self are between [0, 127].

◆ isNull()

bool RWCString::isNull ( ) const
inline

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

◆ last() [1/4]

size_t RWCString::last ( char c) const
inline
Deprecated
As of SourcePro 12, use RWCString::lastOf(char, size_t) const instead.

◆ last() [2/4]

size_t RWCString::last ( char c,
size_t  ) const
inline
Deprecated
As of SourcePro 12, use RWCString::lastOf(char, size_t) const instead.

◆ last() [3/4]

size_t RWCString::last ( const char * str) const
inline

◆ last() [4/4]

size_t RWCString::last ( const char * str,
size_t len ) const
inline

◆ lastNotOf() [1/7]

size_t RWCString::lastNotOf ( char c,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence of a character in self that is not c, ending at position pos. Returns RW_NPOS if there is no match.

◆ lastNotOf() [2/7]

size_t RWCString::lastNotOf ( const char * str,
size_t pos,
size_t len ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in the last len bytes of str. Returns RW_NPOS if there is no match.

◆ lastNotOf() [3/7]

size_t RWCString::lastNotOf ( const char * str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in the null-terminated string str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.

◆ lastNotOf() [4/7]

size_t RWCString::lastNotOf ( const ConstSubString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ lastNotOf() [5/7]

size_t RWCString::lastNotOf ( const RWCString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in str. Returns RW_NPOS if there is no match.

◆ lastNotOf() [6/7]

size_t RWCString::lastNotOf ( const std::string & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in str. Returns RW_NPOS if there is no match.

◆ lastNotOf() [7/7]

size_t RWCString::lastNotOf ( const SubString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character not in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ lastOf() [1/7]

size_t RWCString::lastOf ( char c,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence of the character c in self, ending at position pos. Returns RW_NPOS if there is no match.

◆ lastOf() [2/7]

size_t RWCString::lastOf ( const char * str,
size_t pos,
size_t len ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in the last len bytes of str. Returns RW_NPOS if there is no match.

◆ lastOf() [3/7]

size_t RWCString::lastOf ( const char * str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in the null-terminated string str. Returns RW_NPOS if there is no match.

Note
This function is incompatible with str strings with embedded nulls.

◆ lastOf() [4/7]

size_t RWCString::lastOf ( const ConstSubString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ lastOf() [5/7]

size_t RWCString::lastOf ( const RWCString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in str. Returns RW_NPOS if there is no match.

◆ lastOf() [6/7]

size_t RWCString::lastOf ( const std::string & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in str. Returns RW_NPOS if there is no match.

◆ lastOf() [7/7]

size_t RWCString::lastOf ( const SubString & str,
size_t pos = RW_NPOS ) const
inline

Returns the index of the last occurrence in self, ending at position pos, of any character in str. Returns RW_NPOS if there is no match.

Note
Behavior is undefined if str is a null substring.

◆ length()

size_t RWCString::length ( ) const
inline

Returns the number of bytes in self.

Note
If self contains any multibyte characters, RWCString::mbLength() should be used to determine the number of characters in self.

◆ match() [1/4]

ConstSubString RWCString::match ( const RWCRExpr & ) const
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ match() [2/4]

SubString RWCString::match ( const RWCRExpr & re)
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ match() [3/4]

SubString RWCString::match ( const RWCRExpr & re,
size_t start )
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ match() [4/4]

ConstSubString RWCString::match ( const RWCRExpr & re,
size_t start ) const
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ mbLength() [1/2]

size_t RWCString::mbLength ( ) const
inline

Returns the number of multibyte characters in self, according to the C++ Standard Library function std::mblen(). Returns RW_NPOS if a bad character is encountered. If self does not contain any multibyte characters, then mbLength() == length().

◆ mbLength() [2/2]

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.

◆ operator const char *()

RWCString::operator const char * ( ) const
inline

The equivalent of calling RWCString::data() on self.

◆ operator()() [1/8]

SubString RWCString::operator() ( const RWCRegexp & re)
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ operator()() [2/8]

ConstSubString RWCString::operator() ( const RWCRegexp & re) const
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ operator()() [3/8]

SubString RWCString::operator() ( const RWCRegexp & re,
size_t start )
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ operator()() [4/8]

ConstSubString RWCString::operator() ( const RWCRegexp & re,
size_t start ) const
Deprecated
As of SourcePro 12, use RWTRegex::search instead.

◆ operator()() [5/8]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the preprocessor macro RWBOUNDS_CHECK has been defined before including <rw/cstring.h>.

Exceptions
RWBoundsErrif RWBOUNDS_CHECK is defined and the index is out of range.

◆ operator()() [6/8]

char RWCString::operator() ( size_t i) const
inline

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. Bounds checking is performed if the preprocessor macro RWBOUNDS_CHECK has been defined before including <rw/cstring.h>.

Exceptions
RWBoundsErrif RWBOUNDS_CHECK is defined and the index is out of range.

◆ operator()() [7/8]

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
RWBoundsErrif the library was built using the RW_DEBUG flag, and start or len are out of range.

◆ operator()() [8/8]

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
RWBoundsErrif the library was built using the RW_DEBUG flag, and start or len are out of range.

◆ operator+=() [1/6]

RWCString & RWCString::operator+= ( char c)
inline

Appends the character c to self. Returns a reference to self.

◆ operator+=() [2/6]

RWCString & RWCString::operator+= ( const char * str)
inline

Appends the null-terminated character string pointed to by str to self. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.

◆ operator+=() [3/6]

RWCString & RWCString::operator+= ( const ConstSubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ operator+=() [4/6]

RWCString & RWCString::operator+= ( const RWCString & str)
inline

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

◆ operator+=() [5/6]

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

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

◆ operator+=() [6/6]

RWCString & RWCString::operator+= ( const SubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ operator=() [1/7]

RWCString & RWCString::operator= ( char c)
inline

Assignment operator. Copies the character c into self.

◆ operator=() [2/7]

RWCString & RWCString::operator= ( const char * str)
inline

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

Note
This function is incompatible with str strings with embedded nulls.

◆ operator=() [3/7]

RWCString & RWCString::operator= ( const ConstSubString & str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.

◆ operator=() [4/7]

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

Assignment operator. The string copies the data from str. Returns a reference to self.

◆ operator=() [5/7]

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

Assignment operator. The string copies the data from str. Returns a reference to self.

◆ operator=() [6/7]

RWCString & RWCString::operator= ( const SubString & str)
inline

Assignment operator. The string copies the data from str. Returns a reference to self.

Note
Behavior is undefined if str is a null substring.

◆ operator=() [7/7]

RWCString & RWCString::operator= ( RWCString && str)
inline

Move assignment. Self takes ownership of the data owned by str.

Condition:
This method is available only on platforms with rvalue reference support.

◆ operator[]() [1/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [2/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [3/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [4/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [5/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [6/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [7/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [8/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [9/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [10/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [11/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [12/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [13/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [14/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [15/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [16/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [17/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [18/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [19/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [20/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [21/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ operator[]() [22/22]

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

Returns the i th byte in self. The index i must be between 0 and the length of the string less one. i is converted to a size_t and bounds checking is performed.

Exceptions
RWBoundsErrif the index is out of range.

◆ prepend() [1/9]

RWCString & RWCString::prepend ( char c,
size_t count = 1 )
inline

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

◆ prepend() [2/9]

RWCString & RWCString::prepend ( const char * str)
inline

Prepends a copy of the null-terminated character string pointed to by str to self. Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.

◆ prepend() [3/9]

RWCString & RWCString::prepend ( const char * str,
size_t len )
inline

Prepends a copy of the character string str to self. Exactly len bytes are copied, including any embedded nulls. Hence, the buffer pointed to by str must be at least len bytes long. Returns a reference to self.

◆ prepend() [4/9]

RWCString & RWCString::prepend ( const ConstSubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ prepend() [5/9]

RWCString & RWCString::prepend ( const RWCString & str)
inline

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

◆ prepend() [6/9]

RWCString & RWCString::prepend ( const RWCString & str,
size_t len )
inline

Prepends the first len bytes of str to self. If len is greater than the length of str, the entire string is prepended. Returns a reference to self.

◆ prepend() [7/9]

RWCString & RWCString::prepend ( const std::string & str)
inline

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

◆ prepend() [8/9]

RWCString & RWCString::prepend ( const std::string & str,
size_t len )
inline

Prepends the first len bytes of str to self. If len is greater than the length of str, the entire string is prepended. Returns a reference to self.

◆ prepend() [9/9]

RWCString & RWCString::prepend ( const SubString & str)
inline

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

Note
Behavior is undefined if str is a null substring.

◆ readFile()

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

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

◆ readLine()

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

Reads bytes from the input stream strm, replacing the previous contents of self, until a newline (or 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 leading white space is skipped (using the iostream library manipulator ws).

◆ readString()

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

Reads bytes from the input stream strm, replacing the previous contents of self, until a null terminator (or EOF) is encountered.

◆ readToDelim()

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

Reads bytes from the input stream strm, replacing the previous contents of self, until the delimiting character delim (or EOF) is encountered. The delimiter is removed from the input stream but is not stored.

◆ readToken()

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

White space is skipped before reading from strm. Bytes are then read from the input stream strm, replacing previous contents of self, until trailing white space or 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 C++ Standard Library function std::isspace().

Note
This function is incompatible with streams containing MBCS.

◆ remove() [1/2]

RWCString & RWCString::remove ( size_t pos)
inline

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

◆ remove() [2/2]

RWCString & RWCString::remove ( size_t pos,
size_t len )
inline

Removes len bytes or to the end of string (whichever comes first) starting at index pos, which must be no greater than length(). Returns a reference to self.

◆ replace() [1/10]

RWCString & RWCString::replace ( const RWCRExpr & re,
const char * str,
scopeType scope = one )
Deprecated
As of SourcePro 12, use RWTRegex::replace instead.

◆ replace() [2/10]

RWCString & RWCString::replace ( const RWCRExpr & re,
const RWCString & str,
scopeType scope = one )
Deprecated
As of SourcePro 12, use RWTRegex::replace instead.

◆ replace() [3/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const char * str )
inline

Replaces the substring beginning at pos and of length len with the null-terminated string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Note
This function is incompatible with str strings with embedded nulls.
Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [4/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const char * str,
size_t strLen )
inline

Replaces the substring beginning at pos and of length len with strLen bytes from str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [5/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const ConstSubString & str )
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
Note
Behavior is undefined if str is a null substring.

◆ replace() [6/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const RWCString & str )
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [7/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const RWCString & str,
size_t strLen )
inline

Replaces the substring beginning at pos and of length len with the first strLen bytes of string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string. If strLen is greater than the length of str, all of str is used.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [8/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const std::string & str )
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [9/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const std::string & str,
size_t strLen )
inline

Replaces the substring beginning at pos and of length len with the first strLen bytes of string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string. If strLen is greater than the length of str, all of str is used.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.

◆ replace() [10/10]

RWCString & RWCString::replace ( size_t pos,
size_t len,
const SubString & str )
inline

Replaces the substring beginning at pos and of length len with the string str. If the sum of pos and len is greater than the length of self, the substring replaced is from pos to end of string.

Returns a reference to self.

Exceptions
RWBoundsErrIf pos is greater than the length of self.
Note
Behavior is undefined if str is a null substring.

◆ resize()

void RWCString::resize ( size_t len)
inline

Changes the length of self to len bytes, adding blanks (i.e., ' ') or truncating as necessary.

◆ rindex() [1/10]

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

Pattern matching. Searches for the last occurrence of the null-terminated string 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 cmp.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [2/10]

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

Pattern matching. Searches for the last occurrence of the null-terminated string pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [3/10]

size_t RWCString::rindex ( const char * pat,
size_t patlen,
size_t end,
caseCompare cmp ) const
inline

Pattern matching. Searches for the last occurrence of the first patlen bytes from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [4/10]

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

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [5/10]

size_t RWCString::rindex ( const ConstSubString & pat,
size_t end = RW_NPOS,
caseCompare cmp = exact ) const
inline

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ rindex() [6/10]

size_t RWCString::rindex ( const RWCString & pat,
size_t end = RW_NPOS,
caseCompare cmp = exact ) const
inline

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [7/10]

size_t RWCString::rindex ( const RWCString & pat,
size_t patlen,
size_t end,
caseCompare cmp ) const
inline

Pattern matching. Searches for the last occurrence of the first patlen bytes from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [8/10]

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

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [9/10]

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

Pattern matching. Searches for the last occurrence of the first patlen bytes from pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ rindex() [10/10]

size_t RWCString::rindex ( const SubString & pat,
size_t end = RW_NPOS,
caseCompare cmp = exact ) const
inline

Pattern matching. Searches for the last occurrence of pat in self that occurs before index end and returns the index of the start of the match. Returns RW_NPOS if there is no such pattern. Case sensitivity is according to cmp.

Note
If cmp is not RWCString::exact this function is incompatible with MBCS strings.
Behavior is undefined if str is a null substring.

◆ shrink()

void RWCString::shrink ( )
inline

Attempts to minimize the memory used by self by reducing the capacity to the minimum required to support the current string length. This operation is non-binding, and may be ignored by the implementation.

◆ std() [1/2]

std::string & RWCString::std ( )
inline

Returns the underlying std::string representation of self.

Note
  • This member function is unavailable on RWCString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteCString

◆ std() [2/2]

const std::string & RWCString::std ( ) const
inline

Returns the underlying std::string representation of self.

Note
  • This member function is unavailable on RWCString if RW_COPY_ON_WRITE_STRING is defined.
  • This member function is unavailable on RWCopyOnWriteCString

◆ strip() [1/2]

SubString RWCString::strip ( stripType st = trailing,
char c = ' ' )

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

◆ strip() [2/2]

ConstSubString RWCString::strip ( stripType st = trailing,
char c = ' ' ) const

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

◆ subString() [1/2]

RWCSubString RWCString::subString ( const char * pat,
size_t start = 0,
caseCompare cmp = exact )
inline

Starting at start, returns a substring representing the first occurrence of the null-terminated string pat in self. If pat is not found, a null substring instance is returned.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ subString() [2/2]

RWCConstSubString RWCString::subString ( const char * pat,
size_t start = 0,
caseCompare cmp = exact ) const
inline

Starting at start, returns a substring representing the first occurrence of the null-terminated string pat in self. If pat is not found, a null substring instance is returned.

Note
This function is incompatible with pat strings with embedded nulls.
If cmp is not RWCString::exact this function is incompatible with MBCS strings.

◆ swap()

void RWCString::swap ( RWCString & str)
inline

Swaps the contents of str with self.

◆ toLower()

void RWCString::toLower ( )
inline

Changes all upper-case letters in self to lower-case, using the C Standard Library facilities declared in <ctype.h>.

Note
This function is incompatible with MBCS strings.

◆ toUpper()

void RWCString::toUpper ( )
inline

Changes all lower-case letters in self to upper-case, using the C Standard Library facilities declared in <ctype.h>.

Note
This function is incompatible with MBCS strings.

Friends And Related Symbol Documentation

◆ operator!=() [1/11]

bool operator!= ( char lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [2/11]

bool operator!= ( const char * lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [3/11]

bool operator!= ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [4/11]

bool operator!= ( const RWCString & lhs,
char rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [5/11]

bool operator!= ( const RWCString & lhs,
const char * rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [6/11]

bool operator!= ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [7/11]

bool operator!= ( const RWCString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [8/11]

bool operator!= ( const RWCString & lhs,
const RWCSubString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [9/11]

bool operator!= ( const RWCString & lhs,
const std::string & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [10/11]

bool operator!= ( const RWCSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator!=() [11/11]

bool operator!= ( const std::string & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs == rhs)

◆ operator+() [1/21]

RWCString operator+ ( const char * lhs,
const RWCConstSubString & rhs )
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.

◆ operator+() [2/21]

RWCString operator+ ( const char * lhs,
const RWCString & rhs )
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.

◆ operator+() [3/21]

RWCString operator+ ( const char * lhs,
const RWCSubString & rhs )
related

Concatenates the null-terminated string lhs and rhs and returns the resulting string.

Note
This function is incompatible with lhs strings with embedded nulls.

◆ operator+() [4/21]

RWCString operator+ ( const RWCConstSubString & lhs,
const char * rhs )
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.

◆ operator+() [5/21]

RWCString operator+ ( const RWCConstSubString & lhs,
const RWCConstSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [6/21]

RWCString operator+ ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [7/21]

RWCString operator+ ( const RWCConstSubString & lhs,
const RWCSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [8/21]

RWCString operator+ ( const RWCConstSubString & lhs,
const std::string & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [9/21]

RWCString operator+ ( const RWCString & lhs,
const char * rhs )
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.

◆ operator+() [10/21]

RWCString operator+ ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [11/21]

RWCString operator+ ( const RWCString & lhs,
const RWCString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [12/21]

RWCString operator+ ( const RWCString & lhs,
const RWCSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [13/21]

RWCString operator+ ( const RWCString & lhs,
const std::string & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [14/21]

RWCString operator+ ( const RWCSubString & lhs,
const char * rhs )
related

Concatenates lhs and the null-terminated string rhs and returns the resulting string.

Note
This function is incompatible with rhs strings with embedded nulls.

◆ operator+() [15/21]

RWCString operator+ ( const RWCSubString & lhs,
const RWCConstSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [16/21]

RWCString operator+ ( const RWCSubString & lhs,
const RWCString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [17/21]

RWCString operator+ ( const RWCSubString & lhs,
const RWCSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [18/21]

RWCString operator+ ( const RWCSubString & lhs,
const std::string & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [19/21]

RWCString operator+ ( const std::string & lhs,
const RWCConstSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [20/21]

RWCString operator+ ( const std::string & lhs,
const RWCString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator+() [21/21]

RWCString operator+ ( const std::string & lhs,
const RWCSubString & rhs )
related

Concatenates lhs and rhs and returns the resulting string.

◆ operator<() [1/11]

bool operator< ( char lhs,
const RWCString & rhs )
related

Returns true if the length of rhs is at least one and the first character of rhs is greater than lhs.

◆ operator<() [2/11]

bool operator< ( const char * lhs,
const RWCString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

Note
This function is incompatible with lhs strings with embedded nulls.

◆ operator<() [3/11]

bool operator< ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [4/11]

bool operator< ( const RWCString & lhs,
char rhs )
related

Returns true if lhs is empty or the first character in lhs is less than rhs. Otherwise returns false.

◆ operator<() [5/11]

bool operator< ( const RWCString & lhs,
const char * rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

Note
This function is incompatible with rhs strings with embedded nulls.

◆ operator<() [6/11]

bool operator< ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [7/11]

bool operator< ( const RWCString & lhs,
const RWCString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [8/11]

bool operator< ( const RWCString & lhs,
const RWCSubString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [9/11]

bool operator< ( const RWCString & lhs,
const std::string & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [10/11]

bool operator< ( const RWCSubString & lhs,
const RWCString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<() [11/11]

bool operator< ( const std::string & lhs,
const RWCString & rhs )
related

Returns true if lhs lexicographically precedes rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator<<() [1/3]

RWFile & operator<< ( RWFile & file,
const RWCString & str )
related

Saves string str to an RWFile.

◆ operator<<() [2/3]

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

Saves string str to a virtual stream.

◆ operator<<() [3/3]

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

Outputs an RWCString on std::ostream os.

◆ operator<=() [1/11]

bool operator<= ( char lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [2/11]

bool operator<= ( const char * lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [3/11]

bool operator<= ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [4/11]

bool operator<= ( const RWCString & lhs,
char rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [5/11]

bool operator<= ( const RWCString & lhs,
const char * rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [6/11]

bool operator<= ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [7/11]

bool operator<= ( const RWCString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [8/11]

bool operator<= ( const RWCString & lhs,
const RWCSubString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [9/11]

bool operator<= ( const RWCString & lhs,
const std::string & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [10/11]

bool operator<= ( const RWCSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator<=() [11/11]

bool operator<= ( const std::string & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator==() [1/11]

bool operator== ( char lhs,
const RWCString & rhs )
related

Returns true if rhs has a length of one and the first character rhs is identical to the char lhs.

◆ operator==() [2/11]

bool operator== ( const char * lhs,
const RWCString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

Note
This function is incompatible with lhs strings with embedded nulls.

◆ operator==() [3/11]

bool operator== ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [4/11]

bool operator== ( const RWCString & lhs,
char rhs )
related

Returns true if lhs has a length of one and the first character lhs is identical to the char rhs.

◆ operator==() [5/11]

bool operator== ( const RWCString & lhs,
const char * rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

Note
This function is incompatible with rhs strings with embedded nulls.

◆ operator==() [6/11]

bool operator== ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [7/11]

bool operator== ( const RWCString & lhs,
const RWCString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [8/11]

bool operator== ( const RWCString & lhs,
const RWCSubString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [9/11]

bool operator== ( const RWCString & lhs,
const std::string & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [10/11]

bool operator== ( const RWCSubString & lhs,
const RWCString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator==() [11/11]

bool operator== ( const std::string & lhs,
const RWCString & rhs )
related

Returns true if lhs is lexicographically equal to rhs. Otherwise returns false. Use member RWCString::collate() or RWCString::strXForm() for locale-sensitive comparisons.

◆ operator>() [1/11]

bool operator> ( char lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [2/11]

bool operator> ( const char * lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [3/11]

bool operator> ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [4/11]

bool operator> ( const RWCString & lhs,
char rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [5/11]

bool operator> ( const RWCString & lhs,
const char * rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [6/11]

bool operator> ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [7/11]

bool operator> ( const RWCString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [8/11]

bool operator> ( const RWCString & lhs,
const RWCSubString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [9/11]

bool operator> ( const RWCString & lhs,
const std::string & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [10/11]

bool operator> ( const RWCSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>() [11/11]

bool operator> ( const std::string & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(rhs < lhs)

◆ operator>=() [1/11]

bool operator>= ( char lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [2/11]

bool operator>= ( const char * lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [3/11]

bool operator>= ( const RWCConstSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [4/11]

bool operator>= ( const RWCString & lhs,
char rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [5/11]

bool operator>= ( const RWCString & lhs,
const char * rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [6/11]

bool operator>= ( const RWCString & lhs,
const RWCConstSubString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [7/11]

bool operator>= ( const RWCString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [8/11]

bool operator>= ( const RWCString & lhs,
const RWCSubString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [9/11]

bool operator>= ( const RWCString & lhs,
const std::string & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [10/11]

bool operator>= ( const RWCSubString & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>=() [11/11]

bool operator>= ( const std::string & lhs,
const RWCString & rhs )
related

The equivalent of calling:

!(lhs < rhs)

◆ operator>>() [1/3]

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.

◆ operator>>() [2/3]

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.

◆ operator>>() [3/3]

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.

◆ strXForm() [1/2]

RWCString strXForm ( const RWCString & str)
related

Returns the result of applying std::strxfrm() to str to allow quicker collation than RWCString::collate().

Note
This function is incompatible with str strings with embedded nulls.

◆ strXForm() [2/2]

RWCString strXForm ( const std::string & str)
related
Deprecated
As of SourcePro 12, use strXForm(const RWCString&) instead.

◆ toLower()

RWCString toLower ( const RWCString & str)
related

Returns a copy of str with all upper-case characters replaced with lower-case characters. This function is the equivalent of calling:

RWCString tmp(str);
tmp.toLower();

◆ toUpper()

RWCString toUpper ( const RWCString & str)
related

Returns a copy of str with all lower-case characters replaced with upper-case characters. This function is the equivalent of calling:

RWCString tmp(str);
tmp.toUpper();

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.