mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[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:
parent
ff137bba24
commit
ea5788ff70
2 changed files with 19 additions and 1 deletions
|
|
@ -191,6 +191,24 @@ inline bool isNumericOrSpace(wchar_t wchar)
|
||||||
return isNumeric(wchar) || wchar == L' ';
|
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)
|
inline bool isBasicLatinString(std::wstring wstr, bool numericOrSpace)
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < wstr.size(); ++i)
|
for(size_t i = 0; i < wstr.size(); ++i)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9676"
|
#define REVISION_NR "9684"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue