mirror of
https://github.com/hyprwm/hyprutils.git
synced 2026-04-22 14:40:39 +02:00
string: add isNumber2 for sv
This commit is contained in:
parent
6b4c47661e
commit
668b22df50
2 changed files with 5 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ namespace Hyprutils {
|
|||
std::string trim(const std::string& in);
|
||||
std::string_view trim(const std::string_view& in);
|
||||
bool isNumber(const std::string& str, bool allowfloat = false);
|
||||
bool isNumber2(const std::string_view& str, bool allowfloat = false);
|
||||
void replaceInString(std::string& string, const std::string& what, const std::string& to);
|
||||
bool truthy(const std::string_view& in);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,6 +44,10 @@ std::string Hyprutils::String::trim(const char* in) {
|
|||
}
|
||||
|
||||
bool Hyprutils::String::isNumber(const std::string& str, bool allowfloat) {
|
||||
return isNumber2(str, allowfloat);
|
||||
}
|
||||
|
||||
bool Hyprutils::String::isNumber2(const std::string_view& str, bool allowfloat) {
|
||||
if (str.empty())
|
||||
return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue