ccuty  1.0
 All Classes Namespaces Files Functions Enumerations Macros Pages
Public Member Functions | List of all members
ccuty::strdelim Struct Reference

Delimiters for strsplit(), regsplit(), strtoken() and strtrim(). More...

Public Member Functions

 strdelim ()
 contructor that specifies that all whitespaces are delimiters.
 
 strdelim (const std::string &delimiters)
 contructor that sets the delimiters (see pattern()).
 
 strdelim (const char *delimiters)
 contructor that sets the delimiters (see pattern()).
 
void reset ()
 resets the strdelim so that it can be used again (useful only for strtoken()).
 
void pattern (const std::string &delimiters)
 changes delimiters. More...
 
strdelimspaces (bool val=true)
 specifies that all whitespaces are delimiters.
 
strdelimquotes (bool val=true)
 specifies that simple and double quotes are taken into account (no effect with regsplit()).
 
strdelimtrim (bool val=true)
 specifies that tokens must be trimmed (the default).
 
void pos (size_t val)
 changes the starting position in the string (default is 0).
 
size_t pos () const
 returns the position in the string after calling strtoken().
 
char matched () const
 returns the delimited that was found after calling strtoken()).
 

Detailed Description

Delimiters for strsplit(), regsplit(), strtoken() and strtrim().

Member Function Documentation

void ccuty::strdelim::pattern ( const std::string &  delimiters)
inline

changes delimiters.

delimiters specifies the delimiters. All whitespaces match if delimiters is the empty string. Otherwise:

  • 1) With strplit() and strtoken(), all characters are taken as delimiters;
  • 2) With regplit(), delimiters is a regex;
  • 3) With strtrim(), delimiters are removed on the left/right side of the string.

The documentation for this struct was generated from the following file: