25 #ifndef __STRING_UTILS_HH__
26 #define __STRING_UTILS_HH__
36 #include <BIAS_DeclSpec.hh>
37 #include <Base/Debug/Error.hh>
71 void Explode(
const std::string &str,
72 const std::string &seperator,
73 std::vector<std::string> &ret);
86 void SplitByChars(
const std::string &str,
87 std::vector<std::string> &ret,
88 const std::string &charsToSplit =
"\t\n ,;");
111 void Trim(
const std::string &str,
113 const std::string &charsToTrim =
" \t\n");
123 std::string str1Cpy( str1 );
124 std::string str2Cpy( str2 );
125 std::transform( str1Cpy.begin(), str1Cpy.end(), str1Cpy.begin(), ::tolower );
126 std::transform( str2Cpy.begin(), str2Cpy.end(), str2Cpy.begin(), ::tolower );
127 return ( str1Cpy == str2Cpy );
135 BIASWARNONCE(
"deprecated, call PadUintByNumChars() instead")
136 return PadUintByNumChars(value, num);
154 std::stringstream ss;
155 ss << std::setfill(
'0') << std::setw(num) << value;
173 std::stringstream ss;
176 const unsigned int lengthMax = ss.str().size();
179 ss << std::setw(lengthMax) << std::setfill(
'0') << value;
194 #endif // __STRING_UTILS_HH__
static std::string LeadingZeroString(int value, int num)
static std::string PadUintByMaxValue(unsigned int value, unsigned int max)
Pads the given value with leading zeroes so that the string representation will use the same number o...
static std::string PadUintByNumChars(unsigned int value, unsigned int num)
Pads the given number with leading zeroes so that the string representation will use the number of ch...
static bool CompareNoCase(const std::string &str1, const std::string &str2)
compare two strings ignoring their case
Contains some useful methods for string manipulation.