Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Michael Segel — — source: Informix-list mailing list archive (1991-1998)
jparker@epsilon.com wrote:
> What I don't like about this approach is that it is time consuming.
> Anytime you ask 4gl to wander through a string you're wasting time. Not a
> big deal when you're talking onsey-twosey, but when this is a core
> algorithm for thousands or millions of records/rows it can get quite
> expensive. Much better to call a 'c' routine in these cases.
>
> cheers
> j.
Sigh,
Try this.
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctypes.h>
/* If not already defined */
#define TRUE 1
#define FALSE 0
int is_num( char *string)
{
char *ptr;
int flag, len;
flag = TRUE;
ptr = string;
len = strlen(string);
while ( flag && len) {
if ( (isdigit(*ptr) == 0))
flag = FALSE;
ptr++;
len -= 1;
}
return (flag);
}
Caveats:
I wrote it so use it at your own peril!
This was written on the fly and hasn't been tested. In other words, it aint
kosher!
So play with this code.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.