[9684] Add helper function to check if a string is numeric

(based on DasBlub's repo commit 1d5b209)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
DasBlub 2010-04-07 00:15:16 +04:00 committed by VladimirMangos
parent ff137bba24
commit ea5788ff70
2 changed files with 19 additions and 1 deletions

View file

@ -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)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9676"
#define REVISION_NR "9684"
#endif // __REVISION_NR_H__