GetAsNumber()
Category: Text
Syntax: GetAsNumber ( text ) |
Parameters:
textAny valid text expression that contains numbers.
Data type returned: Number
Description:
GetAsNumber() returns only the numbers from a text string, as a data type number. All non-numeric characters are dropped from the string.
Use GetAsNumber() to strip all non-numeric characters out of a text string. For instance, you might have a phone number field to which you want to apply some formatting. GetAsNumber (PhoneNumber) returns just the numeric characters from the field, stripping all punctuation and spaces, so that you can then apply whatever new formatting you wish.
GetAsNumber() can also be applied to date and time fields to coerce the data into its integer representation. For instance,
GetAsNumber (Get (CurrentDate))
returns 731689 when the date is 4/18/2004.
Examples:
Function |
Results |
---|---|
GetAsNumber ("abc123") |
Returns 123. |
GetAsNumber ("$100.10") |
Returns 100.1. |