Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internationalization Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWUStringSearch

Module:  Internationalization Module   Group:  Unicode String Processing


Does Not Inherit

Local Index

Members

Header File

#include <rw/i18n/RWUStringSearch.h> 

Description

RWUStringSearch searches text for occurrences of a specified pattern string. The pattern string is not a pattern in the sense of a regular expression (see RWURegularExpression), but rather a string to be searched for.

RWUStringSearch allows for flexible, collation-based string searches, unlike searches performed by RWUString::index() and RWUString::subString(). RWUString uses simple bit-wise comparisons of the code units in the strings, but RWUStringSearch employs the rules encapsulated by an RWUCollator and an optional RWUBreakSearch to determine if and where a match occurs.

RWUStringSearch provides a number of options to search for occurrences of the pattern string in a text string:

With iterator-style searches, RWUStringSearch, like RWUBreakSearch, maintains a "current" position within the source string. A call to first() or last() sets the current position to the code unit offset just past that of the first or last match, respectively, and returns the location of the beginning of the match. Method next() advances the current position to the code unit offset immediately following that of the next match, and returns the location of the new match. Method previous() moves the current position to the beginning of the previous non-overlapping match, and returns the location of the new match.

Example

Related Classes

RWUString, RWURegularExpression, RWUBreakSearch

Public Constructors

RWUStringSearch(const RWUString&   pattern,
                const RWUString&   text,
                const RWUCollator& collator);
RWUStringSearch(const RWUString& pattern,
                const RWUString& text,
                const RWUCollator& collator,
                const RWUBreakSearch& breakSearch);
RWUStringSearch(const RWUString& pattern,
                const RWUString& text,
                const RWULocale& locale = 
                   RWULocale::getDefault(),
                RWUBreakSearch::BreakType breakType = 
                   RWUBreakSearch::CodePoint);
RWUStringSearch(const RWUStringSearch& source);

Public Destructor

~RWUStringSearch();

Public Member Operators

RWUStringSearch&
operator=(const RWUStringSearch& rhs);

Public Member Functions

void
clearBreakSearch(void);
RWUConstStringIterator
current(void) const;
RWUConstStringIterator
first(void);
RWUBreakSearch::BreakType
getBreakType() const;
const RWUCollator&
getCollator(void) const;
RWUConstSubString
getMatch(void) const;
size_t
getMatchLength(void) const;
RWUConstStringIterator
getMatchStart(void) const;
RWUString
getPattern(void) const;
const RWUString& 
getString(void) const;
bool
isMatch(const RWUConstStringIterator& position);
RWUConstStringIterator
last(void);
RWUConstStringIterator
next(void);
RWUConstStringIterator
next(const RWUConstStringIterator& position);
RWUConstStringIterator
previous(void);
RWUConstStringIterator
previous(const RWUConstStringIterator& position);
size_t
replace(RWUString& str, const RWUString& replacement, 
        size_t  occurrences = 1); 
void
setBreakSearch(const RWUBreakSearch &bSearch);
void
setCollator(const RWUCollator &collator);
void
setPattern(const RWUString &pattern);
void
setString(const RWUString &text);


Previous fileTop of DocumentContentsIndex pageNext file

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