ug4
string_util.cpp File Reference
#include "string_util.h"
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cctype>
#include <fstream>
#include "common/common.h"
#include "common/assert.h"
#include "common/profiler/profiler.h"

Namespaces

 ug
 the ug namespace
 

Functions

void ug::AppendCounterToString (string &str, string indicator, int counter, int maxCounter)
 
string ug::AppendSpacesToString (string &str, int totalLength)
 
string ug::ConfigShift (string s)
 
char ug::ConfigShiftRotation (char c)
 
bool ug::Contains (const string &str, const string &search)
 
string ug::FilenameAndPathWithoutExtension (string str)
 
string ug::FilenameWithoutExtension (string str)
 
string ug::FilenameWithoutPath (const string &str)
 
vector< string > ug::FindDuplicates (const vector< string > &vec)
 
string ug::GetBytesSizeString (size_t s, int length)
 
string::size_type ug::GetDirectorySeperatorPos (const string &str)
 
string ug::GetFileLine (const char *filename, size_t line)
 get a specific line of a file More...
 
string ug::GetFileLines (const char *filename, size_t fromline, size_t toline, bool includeLineNumbers)
 get some specified lines of a file More...
 
string ug::GetFilenameExtension (const string &str)
 
template<>
size_t ug::hash_key (const string &key)
 
bool ug::IsLonger (const string &a, const string &b)
 
bool ug::IsShiftChar (char c)
 
size_t ug::LevenshteinDistance (const string &s1, const string &s2)
 
int ug::NumberOfDigits (int n)
 returns the number of digits of an integer (expressed with base 10) More...
 
string ug::PathFromFilename (const string &str)
 
void ug::RemoveWhitespaceFromString (std::string &string)
 removes all white space from a string, also within the string More...
 
string ug::repeat (char c, int nr)
 Builds a string with specified repetitions of given character. More...
 
string ug::ReplaceAll (string target, const string &oldstr, const string &newstr)
 
string ug::SnipString (const string &str, size_t totalSize, size_t replaceLast, const char replace)
 
string ug::SnipStringFront (const string &str, size_t totalSize, size_t replaceFirst, const char replace)
 
bool ug::StartsWith (const string &str, const string &begin)
 
vector< string > ug::TokenizeString (const char *str, const char delimiter=',')
 splits the string into parts based on a separating character More...
 
vector< string > ug::TokenizeString (const string &str, const char delimiter)
 
void ug::TokenizeString (const string &str, vector< string > &vToken, const char delimiter)
 
vector< string > ug::TokenizeTrimString (const string &str, const char delimiter)
 
void ug::TokenizeTrimString (const string &str, vector< string > &vToken, const char delimiter)
 
string ug::ToLower (string str)
 
string ug::ToUpper (string str)
 
string ug::TrimString (const string &str)
 
bool ug::WildcardMatch (const char *str, const char *pattern)
 wildcard matches like bla.* or *.bla or t?st More...
 
string ug::XMLStringEscape (string s)
 

Variables

const unsigned int ug::cost_del = 1
 
const unsigned int ug::cost_ins = 1
 
const unsigned int ug::cost_sub = 1
 
static const char ug::shiftCharacters [] = "|#[+"
 
static const size_t ug::shiftCharactersLength = sizeof(shiftCharacters)/sizeof(shiftCharacters[0])