Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide

RWWSubString

Module:  Essential Tools Module   Group:  String Processing


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/wstring.h>
RWWString s(L"test string");
s(6,3);   // "tri"

Description

The class RWWSubString allows some subsection of an RWWString to be addressed by defining a starting position and an extent. For example the 7th through the 11th elements, inclusive, would have a starting position of 7 and an extent of 5. The specification of a starting position and extent can also be done in your behalf by such functions as RWWString::strip() or the overloaded function call operator taking a regular expression as an argument. There are no public constructors -- RWWSubStrings are constructed by various functions of the RWWString class and then destroyed immediately.

A zero length substring is one with a defined starting position and an extent of zero. It can be thought of as starting just before the indicated character, but not including it. It can be used as an lvalue. A null substring is also legal and is frequently used to indicate that a requested substring, perhaps through a search, does not exist. A null substring can be detected with member function isNull(). However, it cannot be used as an lvalue.


NOTE -- Member function overloads with std::wstring will only appear when building on top of the Standard C++ Library.

Persistence

None

Example

Program output:

Assignment Operators

RWWSubString&
operator=(const RWWString&);
RWWSubString&
operator=(const std::wstring& str);
RWWSubString&
operator=(const RWWSubString&);
RWWSubString&
operator=(const RWWConstSubString&);
RWWSubString&
operator=(const wchar_t*);

Indexing Operators

wchar_t
operator[](size_t i); 
wchar_t&
operator[](size_t i) const;
wchar_t
operator()(size_t i); 
wchar_t&
operator()(size_t i) const;

Public Member Functions

RWBoolean
isNull() const; 
size_t
length() const; 
RWBoolean
operator!() const; 
size_t
start() const; 
void
toLower();
void
toUpper();

Global Logical Operators

RWBoolean
operator==(const RWWSubString&, const RWWSubString&);
RWBoolean
operator==(const RWWString&,    const RWWSubString&);
RWBoolean
operator==(const RWWSubString&, const RWWString&   );
RWBoolean
operator==(const wchar_t*,      const RWWSubString&);
RWBoolean
operator==(const RWWSubString&, const wchar_t*     );
RWBoolean
operator!=(const RWWString&,    const RWWString&   ); 
RWBoolean
operator!=(const RWWString&,    const RWWSubString&);
RWBoolean
operator!=(const RWWSubString&, const RWWString&   );
RWBoolean
operator!=(const wchar_t*,      const RWWString&   );
RWBoolean
operator!=(const RWWString&,    const wchar_t*     );


Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.