33 #ifndef __H__COMMON_STRING_UTIL__
34 #define __H__COMMON_STRING_UTIL__
66 const char delimiter=
',' );
76 const char delimiter=
',' );
86 const char delimiter=
',' );
97 const char delimiter=
',');
107 const char delimiter=
',' );
131 size_t replaceLast = 0,
const char replace =
'.');
142 size_t replaceFront = 0,
const char replace =
'.');
165 int counter,
int maxCounter=-1 );
254 const std::string& newstr );
332 UG_API std::string
GetFileLines(
const char *filename,
size_t fromline,
size_t toline,
333 bool includeLineNumbers );
364 std::stringstream out;
425 std::stringstream ss; ss << t;
439 return b ?
"TRUE" :
"FALSE";
444 return b ?
"ON" :
"OFF";
448 template<
typename... Args >
451 int length = std::snprintf(
nullptr, 0, format, args... );
452 assert( length >= 0 );
454 char* buf =
new char[length + 1];
455 std::snprintf( buf, length + 1, format, args... );
457 std::string str( buf );
int NumberOfDigits(int nsigned)
returns the number of digits of an integer (expressed with base 10)
Definition: string_util.cpp:136
std::string ToString(const T &t)
Convert a object supporting 'std::cout << obj' to a string.
Definition: string_util.h:362
void RemoveWhitespaceFromString(std::string &str)
removes all white space from a string, also within the string
Definition: string_util.cpp:50
string GetFileLine(const char *filename, size_t line)
get a specific line of a file
Definition: string_util.cpp:383
bool WildcardMatch(const char *str, const char *pattern)
wildcard matches like bla.* or *.bla or t?st
Definition: string_util.cpp:388
string GetFileLines(const char *filename, size_t fromline, size_t toline, bool includeLineNumbers)
get some specified lines of a file
Definition: string_util.cpp:359
string repeat(char c, int nr)
Builds a string with specified repetitions of given character.
Definition: string_util.cpp:346
size_t hash_key(const TKey &key)
The hashing method can be specialized for different types.
Definition: hash_function.h:50
#define UG_API
Definition: ug_config.h:65
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)
Definition: bidirectional_boost.h:100
bool Contains(const string &str, const string &search)
Definition: string_util.cpp:249
string FilenameAndPathWithoutExtension(string str)
Definition: string_util.cpp:217
string ToLower(string str)
Definition: string_util.cpp:269
string ReplaceAll(string target, const string &oldstr, const string &newstr)
Definition: string_util.cpp:231
string ConfigShift(string s)
Definition: string_util.cpp:457
string FilenameWithoutPath(const string &str)
Definition: string_util.cpp:195
bool IsLonger(const string &a, const string &b)
Definition: string_util.cpp:354
const char * TrueFalseString(bool b)
Definition: string_util.h:437
void TokenizeTrimString(const string &str, vector< string > &vToken, const char delimiter)
Definition: string_util.cpp:83
vector< string > FindDuplicates(const vector< string > &vec)
Definition: string_util.cpp:279
size_t LevenshteinDistance(const string &s1, const string &s2)
Definition: string_util.cpp:311
void TokenizeString(const string &str, vector< string > &vToken, const char delimiter)
Definition: string_util.cpp:56
const char * OnOffString(bool b)
Definition: string_util.h:442
bool StartsWith(const string &str, const string &begin)
Definition: string_util.cpp:245
string TrimString(const string &str)
Definition: string_util.cpp:104
string ToUpper(string str)
Definition: string_util.cpp:274
string::size_type GetDirectorySeperatorPos(const string &str)
Definition: string_util.cpp:183
string PathFromFilename(const string &str)
Definition: string_util.cpp:202
string SnipStringFront(const string &str, size_t totalSize, size_t replaceFirst, const char replace)
Definition: string_util.cpp:124
string GetBytesSizeString(size_t s, int length)
Definition: string_util.cpp:489
std::string OstreamShift(const T &t)
Definition: string_util.h:423
std::string GetStringPrintf(const char *format, Args... args)
Definition: string_util.h:449
string FilenameWithoutExtension(string str)
Definition: string_util.cpp:209
string AppendSpacesToString(string &str, int totalLength)
Definition: string_util.cpp:175
string GetFilenameExtension(const string &str)
Definition: string_util.cpp:224
void AppendCounterToString(string &str, string indicator, int counter, int maxCounter)
Definition: string_util.cpp:154
string XMLStringEscape(string s)
Definition: string_util.cpp:430
string SnipString(const string &str, size_t totalSize, size_t replaceLast, const char replace)
Definition: string_util.cpp:112