Consultor Eletrônico



Kbase 18260: How to tell if character string contains only integers
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   22/09/1998
How to tell if character string contains only integers


The way to test if a character string in a variable or field consists
only of integers or includes alphabetical characters, use the INTEGER
function with NO-ERROR, then test the ERROR-STATUS:ERROR attribute.

DEF VAR x AS CHAR.
DEF VAR i AS INTEGER.

UPDATE x.

i = INTEGER(x) NO-ERROR.

IF ERROR-STATUS:ERROR THEN MESSAGE "alphabeticals detected".
ELSE MESSAGE "string contains only integers".