#include <cctype>
#include <set>
#include <string>
Go to the source code of this file.
Functions | |
template<class Itr > | |
void | split (const std::string &in, const char *delim, Itr out) |
Split a string into tokens separated by the given delimiters. | |
template<class Itr > | |
std::string | join (Itr it, Itr stop, const char *delim) |
Join a sequence of tokens with the given delimiter. | |
template<class Itr > | |
std::string | lineWrap (Itr itr, Itr stop, size_t linelength, const std::string &pfx=std::string(), const std::string &sfx=std::string()) |
Wrap a sequence of words into a multi-line string, with optional prefix and suffix. | |
std::string | stdLineWrap (const std::string &in, size_t linelength, const std::string &pfx=std::string(), const std::string &sfx=std::string()) |
Split a string on whitespace, then wrap into a multi-line string with optional prefix and suffix. | |
std::string | toLowerCase (const std::string &in) |
Make a lowercase string out of the input string. | |
std::string | toUpperCase (const std::string &in) |
Make an uppercase string out of the input string. | |
unsigned int | levenshteinDistance (const std::string &s, const std::string &t) |
Compute the Levenshtein distance between two strings. | |
unsigned int | damerauLevenshteinDistance (const std::string &s, const std::string &t) |
Compute the Damerau-Levenshtein distance between two strings. | |
std::string | camelCaseToSpaces (const std::string &s, const std::set< std::string > *acronyms) |
Convert a CamelCase string to a string of space-separated words. | |
std::string | trim (std::string const &str) |
Remove whitespace from the beginning and end of the input string. |
Definition in file StringUtil.H.
std::string camelCaseToSpaces | ( | const std::string & | s, | |
const std::set< std::string > * | acronyms | |||
) |
Convert a CamelCase string to a string of space-separated words.
acronyms | If non-null, this set of uppercase acronyms will be used as a heuristic to find proper word boundaries. |
Definition at line 136 of file StringUtil.C.
Referenced by ModelParamBase::getNameWithSpaces().
unsigned int damerauLevenshteinDistance | ( | const std::string & | s, | |
const std::string & | t | |||
) |
Compute the Damerau-Levenshtein distance between two strings.
http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance
Definition at line 96 of file StringUtil.C.
std::string join | ( | Itr | it, | |
Itr | stop, | |||
const char * | delim | |||
) | [inline] |
Join a sequence of tokens with the given delimiter.
Example:
const char* toks[] = { "foo", "bar", "baz" }; string s = join(&toks[0], &toks[0] + 3, "||"); // s == "foo||bar||baz";
Definition at line 94 of file StringUtil.H.
Referenced by EyeTrace::EyeTrace(), TrackerHandController::start1(), EyeTrackerEyeHeadController::start1(), and submain().
unsigned int levenshteinDistance | ( | const std::string & | s, | |
const std::string & | t | |||
) |
Compute the Levenshtein distance between two strings.
http://en.wikipedia.org/wiki/Levenshtein_distance
Definition at line 61 of file StringUtil.C.
std::string lineWrap | ( | Itr | itr, | |
Itr | stop, | |||
size_t | linelength, | |||
const std::string & | pfx = std::string() , |
|||
const std::string & | sfx = std::string() | |||
) | [inline] |
Wrap a sequence of words into a multi-line string, with optional prefix and suffix.
Use stdLineWrap() if you have a single string that should be first split into words on standard whitespace and then line-wrapped.
Definition at line 111 of file StringUtil.H.
Referenced by stdLineWrap().
void split | ( | const std::string & | in, | |
const char * | delim, | |||
Itr | out | |||
) | [inline] |
Split a string into tokens separated by the given delimiters.
Example:
string s = "/:/foo::bar/:baz///"; vector<string> tokens; split(s, ":/", std::back_inserter(tokens)); // tokens now contains { "foo", "bar", "baz" };
Definition at line 60 of file StringUtil.H.
Referenced by RawGistEstimatorStd::computeFeatureVector(), convertFromString(), EyeTrace::EyeTrace(), FrameRange::fromString(), HandTrace::HandTrace(), EyeData::hasSaccadeTargetData(), main(), VisualCortexConfigurator::paramChanged(), MultiSpectralResidualChannel::paramChanged(), SimulationViewerStd::prepMapForDisplay(), Stimulus2D::setConfigInfo(), EyesalData::setFile(), DiskDataStream::setSavePath(), VisualCortexEyeMvt::start1(), TrackerHandController::start1(), EyeTrackerEyeHeadController::start1(), SVMClassifierModule::start2(), GentleBoostComponent::start2(), stdLineWrap(), and submain().
std::string stdLineWrap | ( | const std::string & | in, | |
size_t | linelength, | |||
const std::string & | pfx = std::string() , |
|||
const std::string & | sfx = std::string() | |||
) |
Split a string on whitespace, then wrap into a multi-line string with optional prefix and suffix.
Definition at line 50 of file StringUtil.C.
References lineWrap(), and split().
Referenced by parseStreamArg().
std::string toLowerCase | ( | const std::string & | in | ) | [inline] |
Make a lowercase string out of the input string.
Definition at line 155 of file StringUtil.H.
Referenced by convertFromString(), TaskRelevanceMapSocial::inputFrame(), and loadPlugin().
std::string toUpperCase | ( | const std::string & | in | ) | [inline] |
Make an uppercase string out of the input string.
Definition at line 164 of file StringUtil.H.
Referenced by convertFromString().
std::string trim | ( | std::string const & | str | ) |
Remove whitespace from the beginning and end of the input string.
Definition at line 221 of file StringUtil.C.