DP3
Classes | Functions
dp3::common::stringtools Namespace Reference

Useful string manipulation methods and classes. More...

Classes

class  Compare
 Functor to compare two strings. Strings can be compared case sensitive (NORMAL) and case insensitive (NOCASE). More...
 

Functions

std::vector< std::string > tokenize (const std::string &str, const std::string &delims)
 

Detailed Description

Useful string manipulation methods and classes.

Function Documentation

◆ tokenize()

std::vector<std::string> dp3::common::stringtools::tokenize ( const std::string &  str,
const std::string &  delims 
)

Tokenize the string str using any character in delim as a separation character. The result does not contain empty strings; consecutive delimiter occurrences count as a single delimiter. Any delimiter occurrences at the beginning or end of str are ignored.

For example:

vector<std::string> tokens = StringUtil::tokenize( " aa\t bb ", " \t" )
std::vector< std::string > tokenize(const std::string &str, const std::string &delims)

would yield the following vector of strings:

///    tokens[0] = "aa"
///    tokens[1] = "bb"
///