User Tools

Site Tools


deformat_return_unformatted_numbers_from_string_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== DEFORMAT (return unformatted numbers from string) ====== Previous pageReturn to chapter overviewNext page

DEFORMAT(string [,picture])

blk2blue.jpg

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 maximum length is 255 (@S255).

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' &amp; DEFORMAT(Phone,@P(###)###-####P) &amp; '<;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

deformat_return_unformatted_numbers_from_string_.htm.txt · Last modified: 2021/04/15 15:57 (external edit)