From ea5788ff7012c3862c40428cb2b3dac0bbb52f01 Mon Sep 17 00:00:00 2001 From: DasBlub Date: Wed, 7 Apr 2010 00:15:16 +0400 Subject: [PATCH] [9684] Add helper function to check if a string is numeric (based on DasBlub's repo commit 1d5b209) Signed-off-by: VladimirMangos --- src/shared/Util.h | 18 ++++++++++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/shared/Util.h b/src/shared/Util.h index aa71e4496..7262f2142 100644 --- a/src/shared/Util.h +++ b/src/shared/Util.h @@ -191,6 +191,24 @@ inline bool isNumericOrSpace(wchar_t wchar) return isNumeric(wchar) || wchar == L' '; } +inline bool isNumeric(std::string const& str) +{ + for(std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr) + if (!isNumeric(*itr)) + return false; + + return true; +} + +inline bool isNumeric(std::wstring const& str) +{ + for(std::wstring::const_iterator itr = str.begin(); itr != str.end(); ++itr) + if (!isNumeric(*itr)) + return false; + + return true; +} + inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace) { for(size_t i = 0; i < wstr.size(); ++i) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ba1c62e08..5fca6e39d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9676" + #define REVISION_NR "9684" #endif // __REVISION_NR_H__