7 for (
const char& i : str)
18 for (std::size_t i = 0; i < str.length(); i++)
20 if (str[i] != find) ss << str[i];
29 if (find.length() == 0)
return str;
33 std::size_t posFound = 0;
34 std::size_t lastFound = 0;
36 while (posFound != std::string::npos)
39 posFound = str.find(find, posFound);
41 if (posFound != std::string::npos)
43 ss << str.substr(lastFound, posFound - lastFound) << subst;
44 posFound += find.length();
48 ss << str.substr(lastFound, (str.length()) - lastFound);
58 if (str.length() == 0)
return false;
60 bool alreadyParsedDecimalPoint =
false;
61 std::size_t digitCount = 0;
63 for (std::size_t i = 0; i < str.length(); i++)
66 ((str[i] >=
'0') && (str[i] <=
'9')) ||
67 ((str[i] ==
'-') && (i == 0)) ||
68 ((str[i] ==
'.') && (allowDecimalPoint) && (!alreadyParsedDecimalPoint) && (digitCount > 0))
74 if (((str[i] >=
'0') && (str[i] <=
'9'))) digitCount++;
75 if (str[i] ==
'.') alreadyParsedDecimalPoint =
true;
79 return digitCount > 0;
84 bool isDecimal =
false;
86 if (str.length() == 0)
return false;
87 if (Contains(str,
'.')) isDecimal =
true;
93 out_number = std::stold(str);
96 catch (std::invalid_argument&)
100 catch (std::out_of_range&)
109 out_number = (
long double)std::stoll(str);
112 catch (std::invalid_argument&)
116 catch (std::out_of_range&)
127 if (str.length() == 0)
return std::vector<std::string>();
129 return SplitString(str, delimiter);
134 if (str.length() == 0)
return std::vector<std::string>();
136 std::vector<std::string> parts;
138 if (delimiter.length() == 0)
140 for (std::size_t i = 0; i < str.length(); i++)
142 parts.push_back(std::string({ str[i] }));
147 std::size_t posFound = 0;
148 std::size_t lastFound = 0;
150 while (posFound != std::string::npos)
152 lastFound = posFound;
153 posFound = str.find(delimiter, posFound);
157 if (posFound != std::string::npos)
159 found = str.substr(lastFound, posFound - lastFound);
160 posFound += delimiter.length();
164 found = str.substr(lastFound, str.length() - lastFound);
167 parts.push_back(found);
175 std::stringstream ss;
176 for (std::size_t i = 0; i < str.length(); i++)
178 if ((str[i] >=
'A') && (str[i] <=
'Z')) ss << (char)(((
int)str[i]) + 32);
179 else if (str[i] == -60) ss << (char)-28;
180 else if (str[i] == -42) ss << (char)-10;
181 else if (str[i] == -36) ss << (char)-4;