Pattern Matching
Class RWCString supports a convenient interface for string searches. In the example below, the code fragment:
 
RWCString s("curiouser and curiouser.");
size_t i = s.index("curious");
will find the start of the first occurrence of curious in s. The comparison will be case sensitive, and the result will be that i is set to 0. To find the index of the next occurrence, you would use:
i = s.index("curious", ++i);
which will result in i set to 14. You can make a case-insensitive comparison with:
 
RWCString s("Curiouser and curiouser.");
size_t i = s.index("curious", 0, RWCString::ignoreCase);
which will also result in i set to 0.
If the pattern does not occur in the string, the index() method returns the special value RW_NPOS.