File indexing completed on 2026-06-02 08:43:50
0001 #ifndef STRING_UTILS_H
0002 #define STRING_UTILS_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <stddef.h>
0012 #include <ctime>
0013 #include <string>
0014 #include <utility>
0015 #include <vector>
0016
0017
0018
0019 namespace ElemUtils {
0020
0021
0022
0023
0024
0025
0026 class StringUtils {
0027
0028 public:
0029
0030 static std::string EMPTY;
0031
0032
0033
0034
0035
0036
0037
0038 static bool isEmpty(const std::string & str);
0039
0040
0041
0042
0043
0044
0045
0046
0047 static bool equals(const std::string & str, const std::string & str2);
0048
0049
0050
0051
0052
0053
0054
0055
0056 static bool equalsIgnoreCase(const std::string &chaine,
0057 const std::string &chaine2, const bool &toUpperCase = true);
0058
0059 static bool contains(const std::string & str,
0060 const std::string & searchString);
0061
0062 static bool containsIgnoreCase(std::string* chaine,
0063 std::string* searchString, bool toUpperCase);
0064
0065 static void replaceAll(std::string & str, const std::string & searchString,
0066 const std::string & replaceString);
0067
0068 static void replaceAllIgnoreCase(std::string* chaine,
0069 std::string* searchString, std::string* replaceString,
0070 bool toUpperCase);
0071
0072
0073 static void trim(std::string &str, const std::string& whitespace = " \t");
0074
0075
0076 static void trimAll(std::string &str, const std::string& whitespace = " \t");
0077
0078 static unsigned int count(std::string str,
0079 const std::string & searchString);
0080
0081
0082
0083
0084
0085
0086
0087
0088 static std::vector<std::string> split(const std::string &chaine,
0089 char splitCharacter);
0090
0091 static std::vector<std::string> split(const std::string &chaine,
0092 const std::string & splitSymbols);
0093
0094
0095
0096
0097
0098
0099
0100 static std::string vectorToString(std::vector<std::string>* vector);
0101
0102 static void to_upperCase(std::string &chaine);
0103
0104 static void to_lowerCase(std::string* chaine);
0105
0106 static std::pair<std::string, std::vector<char> > fromStringToArrayOfChar(
0107 const std::string &string);
0108
0109 static std::string removeAfterLast(const std::string &chaine,
0110 const char lastCharacter);
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120 static size_t findFirstJustAfter(const std::string &file,
0121 const std::string &pattern, const size_t startIndex = 0);
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 static size_t findFirst(const std::string &file, const std::string &pattern,
0132 const size_t startIndex = 0);
0133
0134 static std::string formatDate(const time_t &time,
0135 const std::string &format);
0136 };
0137
0138 }
0139
0140 #endif