Consultor Eletrônico



Kbase P160093: How to convert a string to an integer value?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/02/2010
Status: Unverified

GOAL:

How to convert a string to an integer value?

GOAL:

How to validate a character value can be converted to integer?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
Windows
All Supported Operating Systems

FIX:

Use the following sample code:
DEF VAR ctmp AS CHAR NO-UNDO.
DEF VAR itmp AS INT NO-UNDO.
ctmp = "123abc".
ASSIGN itmp = INTEGER( ctmp ) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
MESSAGE "Invalid integer value for ctmp: " ctmp .