Add parse bool

This commit is contained in:
2025-03-19 13:56:24 +08:00
parent 55d00feb3c
commit 252c20d068
2 changed files with 15 additions and 0 deletions

View File

@@ -131,3 +131,12 @@ std::string str_util::str_join(std::list<std::string> input, std::string pattern
}
return output;
}
bool str_util::parse_bool(std::string input) {
input = tolower(input);
if (input == "true" || input == "yes" || input == "on" || input == "1") {
return true;
} else {
return false;
}
}