|
|
@@ -74,7 +74,7 @@ std::vector<std::basic_string<T>> split(std::basic_string<T> const &s, |
|
|
|
return split(s, std::basic_string<T>(seps)); |
|
|
|
} |
|
|
|
|
|
|
|
// Check whether a string starts or ends with a given substring |
|
|
|
// Check whether a string starts with a given substring |
|
|
|
template<typename T> |
|
|
|
bool starts_with(std::basic_string<T> const &s, |
|
|
|
std::basic_string<T> const &prefix) |
|
|
@@ -89,6 +89,13 @@ bool starts_with(std::basic_string<T> const &s, T const *prefix) |
|
|
|
return starts_with(s, std::basic_string<T>(prefix)); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename T> |
|
|
|
bool starts_with(T const *s, T const *suffix) |
|
|
|
{ |
|
|
|
return starts_with(std::basic_string<T>(s), std::basic_string<T>(suffix)); |
|
|
|
} |
|
|
|
|
|
|
|
// Check whether a string ends with a given substring |
|
|
|
template<typename T> |
|
|
|
bool ends_with(std::basic_string<T> const &s, |
|
|
|
std::basic_string<T> const &suffix) |
|
|
@@ -103,6 +110,12 @@ bool ends_with(std::basic_string<T> const &s, T const *suffix) |
|
|
|
return ends_with(s, std::basic_string<T>(suffix)); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename T> |
|
|
|
bool ends_with(T const *s, T const *suffix) |
|
|
|
{ |
|
|
|
return ends_with(std::basic_string<T>(s), std::basic_string<T>(suffix)); |
|
|
|
} |
|
|
|
|
|
|
|
// Convert a string to lowercase or uppercase |
|
|
|
template<typename T> |
|
|
|
std::basic_string<T> tolower(std::basic_string<T> const &s) |
|
|
|