DEFORMAT (return unformatted numbers from string)

Top  Previous  Next

 

DEFORMAT(string [,picture])

DEFORMAT

Removes formatting characters from a numeric string.

string

A string expression containing a numeric string.

picture

A picture token, or the label of a CSTRING variable containing a picture token. If omitted, the picture for the string parameter is used. If the string parameter was not declared with a picture token, the return value will contain only characters that are valid for a numeric constant.

The DEFORMAT procedure removes formatting characters from a numeric string, returning only the numbers contained in the string. When used with a date or time picture (except those containing alphabetic characters), it returns a STRING containing the Clarion Standard Date or Time.

Return Data Type:

STRING

Example:

!DEFORMAT('$1,234.56')          returns 1234.56

!DEFORMAT('309-53-9954')        returns 309539954

!DEFORMAT('40A1-7',@P##A1-#P)   returns 407

!DEFORMAT('-10000')             returns -10000

!DEFORMAT(' -10000')            returns 10000

 

 

!Get phone number for modem to dial:

DialString = 'ATDT1' & DEFORMAT(Phone,@P(###)###-####P) & '<13,10>'

 

ClarionDate = DEFORMAT(dBaseDate,@D1)   !Clarion Standard date from mm/dd/yy string

 

Data = '45,123'                         !Assign a formatted number to a string

Number = DEFORMAT(Data)                 !then remove non-numeric characters

See Also:

FORMAT

Standard Date

Standard Time

Picture Tokens