Span including / excluding

Web Site  Methods

The four methods described in this topic are low-level tokenization methods. We advise not-so-experienced programmers to rely on Tokenize instead when possible, because of the many border conditions that may arise when using the low-level facilities.

 

 
Str::SpanIncluding
 
Str SpanIncluding (const STRCHAR* tokens) const

This method will return the beginning (left part) of the string, up to (but excluding) the first character not in the passed tokens list. The tokens parameter should contain a string of one or more token characters. This holds true for all four methods described here.

 

 
Str::StringSpanIncluding
 
static CPOS StringSpanIncluding
    (const STRCHAR* s, const STRCHAR* tokens) const

This static method will return the index of the first character in the string that is not one of the passed tokens. May return the index of the terminating string null, which means that:

 

 
Str::SpanExcluding
 
Str SpanExcluding (const STRCHAR* tokens) const

This method will return the beginning (left part) of the string, up to (but excluding) the first character that matches one of the passed tokens.

 

 
Str::StringSpanExcluding
 
static CPOS StringSpanExcluding
    (const STRCHAR* s, const STRCHAR* tokens) const

This static method will return the index of the first character in the string that matches one of the passed tokens (in this regard it is similar to FindOneOf). If the return value is -1, a match was never found.

 

See also: Trimming / case / tokenize, Regular expressions overview