/* ********************************************************************** * Copyright (C) 2001 IBM and others. All rights reserved. ********************************************************************** * Date Name Description * 03/22/2000 helena Creation. ********************************************************************** */ #ifndef STSEARCH_H #define STSEARCH_H #include "unicode/tblcoll.h" #include "unicode/coleitr.h" #include "unicode/search.h" U_NAMESPACE_BEGIN /** * StringSearch is a SearchIterator that provides * language-sensitive text searching based on the comparison rules defined * in a {@link RuleBasedCollator} object. * StringSearch ensures that language eccentricity can be * handled, e.g. for the German collator, characters ß and SS will be matched * if case is chosen to be ignored. * See the * "ICU Collation Design Document" for more information. *

* The algorithm implemented is a modified form of the Boyer Moore's search. * For more information see * * "Efficient Text Searching in Java", published in Java Report * in February, 1999, for further information on the algorithm. *

* There are 2 match options for selection:
* Let S' be the sub-string of a text string S between the offsets start and * end . *
* A pattern string P matches a text string S at the offsets * if *

 
 * option 1. Some canonical equivalent of P matches some canonical equivalent 
 *           of S'
 * option 2. P matches S' and if P starts or ends with a combining mark, 
 *           there exists no non-ignorable combining mark before or after S? 
 *           in S respectively. 
 * 
* Option 2. will be the default· *

* This search has APIs similar to that of other text iteration mechanisms * such as the break iterators in BreakIterator. Using these * APIs, it is easy to scan through text looking for all occurances of * a given pattern. This search iterator allows changing of direction by * calling a reset followed by a next or previous. * Though a direction change can occur without calling reset first, * this operation comes with some speed penalty. * Match results in the forward direction will match the result matches in * the backwards direction in the reverse order *

* SearchIterator provides APIs to specify the starting position * within the text string to be searched, e.g. setOffset, * preceding and following. Since the * starting position will be set as it is specified, please take note that * there are some danger points which the search may render incorrect * results: *