I've add LEFT-TRIM
FUNCTION isInteger RETURNS LOGICAL( cInteger AS CHARACTER) :
DEF VAR lTest AS LOGICAL NO-UNDO.
ASSIGN lTest = (cInteger NE ?) AND
(STRING(INTEGER(cInteger)) EQ LEFT-TRIM(TRIM(cInteger), "0":U)) NO-ERROR.
RETURN lTest.
END FUNCTION.
because of
MESSAGE...
MESSAGE isinteger(' 90')
VIEW-AS ALERT-BOX INFO BUTTONS OK.
It depend if leading space sholud be interpreted as correct integer or not.
MESSAGE isinteger(?)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
Yes , you right, unknown value shold be treated.
FUNCTION isInteger RETURNS LOGICAL( cInteger AS CHARACTER) :
DEFINE VARIABLE iInteger AS INTEGER NO-UNDO.
iInteger = INTEGER(cInteger) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
RETURN FALSE.
IF STRING(iInteger) NE cInteger THEN
RETURN FALSE.
RETURN TRUE.
END FUNCTION.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.