Aggiunto metodo is_natural
git-svn-id: svn://10.65.10.50/trunk@740 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2769497f11
commit
40ebcac0c8
@ -79,6 +79,26 @@ bool real::is_real (const char *s)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool real::is_natural (const char *s)
|
||||||
|
{
|
||||||
|
bool ok = s && *s != '\0';
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
while (*s == ' ')
|
||||||
|
s++; // Remove leading spaces before
|
||||||
|
|
||||||
|
if (*s)
|
||||||
|
{
|
||||||
|
while (isdigit(*s))
|
||||||
|
s++;
|
||||||
|
ok = *s == '\0';
|
||||||
|
}
|
||||||
|
else ok = FALSE;
|
||||||
|
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
real::real (const char *s)
|
real::real (const char *s)
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
static char* eng2ita(char* s);
|
static char* eng2ita(char* s);
|
||||||
static char* ita2eng(const char* s);
|
static char* ita2eng(const char* s);
|
||||||
static bool is_real(const char* n);
|
static bool is_real(const char* n);
|
||||||
|
static bool is_natural(const char* n);
|
||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
DEC* ptr() const { return (DEC*)&_dec; }
|
DEC* ptr() const { return (DEC*)&_dec; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user