StringUtil.C File Reference

#include "Util/StringUtil.H"
#include "Util/Assert.H"
#include <algorithm>
#include <iterator>
#include <vector>
Include dependency graph for StringUtil.C:

Go to the source code of this file.

Defines

#define D_INDEX(i, j)   ((i) + ((j)*(m+1)))
#define D_INDEX(i, j)   ((i) + ((j)*(m+1)))

Functions

std::string stdLineWrap (const std::string &in, size_t linelength, const std::string &pfx, const std::string &sfx)
 Split a string on whitespace, then wrap into a multi-line string with optional prefix and suffix.
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.

Detailed Description

Definition in file StringUtil.C.


Function Documentation

std::string camelCaseToSpaces ( const std::string s,
const std::set< std::string > *  acronyms 
)

Convert a CamelCase string to a string of space-separated words.

Parameters:
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.

References ASSERT, and min().

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.

References ASSERT, and min().

std::string stdLineWrap ( const std::string in,
size_t  linelength,
const std::string pfx,
const std::string sfx 
)

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 trim ( std::string const &  str  ) 

Remove whitespace from the beginning and end of the input string.

Definition at line 221 of file StringUtil.C.

Generated on Sun May 8 08:19:23 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3