diff options
author | Alexander Tkachev | 2016-06-10 14:06:06 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | c99b24c16d1111a701d915832f24ac457aef697d (patch) | |
tree | 9e812538728c8c7bd11ce06f2907cf1850e21df2 /common/str.cpp | |
parent | e6242b0be8fc9f9abc4daf87f80675cca46df4d9 (diff) | |
download | scummvm-rg350-c99b24c16d1111a701d915832f24ac457aef697d.tar.gz scummvm-rg350-c99b24c16d1111a701d915832f24ac457aef697d.tar.bz2 scummvm-rg350-c99b24c16d1111a701d915832f24ac457aef697d.zip |
COMMON: Add String::asUint64()
Instead of all these atoull() I've added everywhere.
Diffstat (limited to 'common/str.cpp')
-rw-r--r-- | common/str.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/str.cpp b/common/str.cpp index 3ff49a90c6..326b4a80d1 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -335,6 +335,15 @@ bool String::contains(char x) const { return strchr(c_str(), x) != NULL; } +uint64 String::asUint64() const { + uint64 result = 0; + for (uint32 i = 0; i < _size; ++i) { + if (_str[i] < '0' || _str[i] > '9') break; + result = result * 10L + (_str[i] - '0'); + } + return result; +} + bool String::matchString(const char *pat, bool ignoreCase, bool pathMode) const { return Common::matchString(c_str(), pat, ignoreCase, pathMode); } |