23 #ifndef STRING_UTILS_H 24 #define STRING_UTILS_H 26 #include "error_treat.h" 38 #define PACKAGE_LOCALE_DIR "/usr/share/locale" 39 #define GETTEXT_PACKAGE "cards" 41 void *Malloc(
size_t s);
45 std::string parameter;
66 void addItemToItemList(
itemList *list,
const char *item);
78 (std::string s,
char delimiter);
80 std::set<std::string> getKeysList
81 (std::string file, std::string delimiter);
83 std::string getValueOfKey
84 (std::string file, std::string delimiter,std::string parameter);
86 std::string getValue(
const std::string& s,
char delimiter);
87 std::string getValueBefore(
const std::string& s,
char del );
88 std::string itos(
unsigned int value);
89 std::string ultos(
unsigned long int value);
91 std::string mtos(mode_t mode);
92 std::string trimFileName(
const std::string& filename);
93 std::string sizeHumanRead(
int value);
97 std::string getFirstValueOfKeyAfterDelim(
const std::string& s,
char delimiter);
101 std::string getFirstValueOfKeyBeforeDelim(
const std::string& s,
char delimiter);
104 std::string stripWhiteSpace(
const std::string& s);
107 std::vector<std::string> parseDelimitedList
108 (
const std::string& s,
const char delimiter);
111 std::set<std::string> parseDelimitedSetList
112 (
const std::string& s,
const char delimiter);
115 bool startsWith(
const std::string& s,
const std::string& with);
121 bool startsWithNoCase(
const std::string& s1,
const std::string& s2);
123 std::string convertToLowerCase(
const std::string& s);
124 std::string convertToUpperCase(
const std::string& s);
126 std::string replaceAll
127 ( std::string& in,
const std::string& oldString,
const std::string& newString );
139 void split(
const std::string& s,
char del,
141 int startPos,
bool useEmpty )
143 std::string line = s;
145 std::string::size_type pos;
146 int offset = startPos;
147 while ( ( pos = line.find( del, offset ) ) != std::string::npos ) {
149 if ( line[pos-1] ==
'\\' ) {
151 ss = ss + line.substr(0,pos);
155 std::string val = line.substr( 0, pos );
156 if ( ( useEmpty || !stripWhiteSpace( val ).empty() ) ||
157 ( ss.length() > 0 ) ) {
158 target.push_back( ss + val );
160 line.erase( 0, pos+1 );
163 if ( ( line.length() > 0 ) || ( ss.length() > 0 ) ) {
164 target.push_back( ss + line );
Definition: libcards.h:481
Definition: libcards.h:472