summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2019-12-30 17:28:35 -0600
committerJordan Woyak <jordan.woyak@gmail.com>2020-01-04 07:19:15 -0600
commit0e8d4cb6ac679fd52a320aae9d1a478e47728116 (patch)
tree8cc5d2713252caa6835005b104830b7c4a80fb1d /Source/Core/Common/StringUtil.cpp
parent7a6a4510f6eed48652200f8c83e79723ae3581f2 (diff)
StringUtil: Make TryParse of floats handle comma and dot decimal separators.
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index 3eeb6d04fe..2369208f45 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -235,51 +235,6 @@ std::string_view StripQuotes(std::string_view s)
return s;
}
-bool TryParse(const std::string& str, u16* const output)
-{
- u64 value;
- if (!TryParse(str, &value))
- return false;
-
- if (value >= 0x10000ull && value <= 0xFFFFFFFFFFFF0000ull)
- return false;
-
- *output = static_cast<u16>(value);
- return true;
-}
-
-bool TryParse(const std::string& str, u32* const output)
-{
- u64 value;
- if (!TryParse(str, &value))
- return false;
-
- if (value >= 0x100000000ull && value <= 0xFFFFFFFF00000000ull)
- return false;
-
- *output = static_cast<u32>(value);
- return true;
-}
-
-bool TryParse(const std::string& str, u64* const output)
-{
- char* end_ptr = nullptr;
-
- // Set errno to a clean slate
- errno = 0;
-
- u64 value = strtoull(str.c_str(), &end_ptr, 0);
-
- if (end_ptr == nullptr || *end_ptr != '\0')
- return false;
-
- if (errno == ERANGE)
- return false;
-
- *output = value;
- return true;
-}
-
bool TryParse(const std::string& str, bool* const output)
{
float value;