Aggiunto metodo is_natural

git-svn-id: svn://10.65.10.50/trunk@740 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1994-12-07 13:38:30 +00:00
parent 2769497f11
commit 40ebcac0c8
2 changed files with 21 additions and 0 deletions

View File

@ -79,6 +79,26 @@ bool real::is_real (const char *s)
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)
{
if (s)

View File

@ -34,6 +34,7 @@ public:
static char* eng2ita(char* s);
static char* ita2eng(const char* s);
static bool is_real(const char* n);
static bool is_natural(const char* n);
// @FPUB
DEC* ptr() const { return (DEC*)&_dec; }