FINDNUM
Searches a string for a numeric value and returns that value as an integer. For example, $100.50 would be returned as 10050.
Syntax
FINDNUM(string,[start,digits,format,symbol, separator,decimal])
Arguments
Argument | Default | Description | |
---|---|---|---|
string | An input string to search for a monetary or numeric value. | ||
[start] | 1 | The column in string at which to begin searching for the value. | |
[digits] | 2 | The number of digits, in the range 0 to 5, to assume follow the decimal. If the actual number of digits that follow the decimal is less than digits, Enrichment pads the return with zeroes. If the actual number of digits that follow the decimal exceeds digits, Enrichment rounds the return at digits. It does not round characters beyond the digits value. | |
[format] | 1 | One of the following to indicate the monetary or numeric format to search for: | |
0 | ($xxx,xxx.xx) | ||
1 | $(xxx,xxx.xx) | ||
2 | -$xxx,xxx.xx | ||
3 | $-xxx,xxx.xx | ||
4 | $ xxx,xxx.xx- | ||
5 | xxx,xxx.xx (no negatives) | ||
6 | ( xxx,xxx.xx) (no currency symbol) | ||
7 | xxx,xxx.xx (no currency symbol) | ||
8 | xxx,xxx.xx- (no currency symbol) | ||
9 | xxx,xxx.xx (no negatives or currency symbol) | ||
10 | $ xxx,xxx.xx DR | ||
11 | xxx,xxx.xx DR | ||
[symbol] | $ | One character that identifies the currency symbol, if any, to search for. Two quotation marks with no intervening space indicates a null symbol value. | |
[separator] | , (comma) | One character that identifies the thousands separator, if any, used in the value. Two quotation marks with no intervening space indicates a null separator value. | |
[decimal] | .(period) | One character that identifies the decimal character, if any, used in the value. Two quotation marks with no intervening space indicates a null decimal value. |
Results
Result | Description | |
---|---|---|
Return | A currency amount stripped of currency symbol, thousands separator, and decimal point. | |
%%RC | One of the following: | |
0 | Value found. | |
1 | Start is less than or equal to 0 | |
2 | The size of string is 0 | |
3 | Start value is larger than the length of strin | |
10 | No symbol found | |
11 | No numeric value found after symbol. | |
12 | An unexpected character was found after symbol. | |
13 | No numeric digits found in string (when not searching for a currency symbol). | |
40 | No closing negative parenthesis found. | |
41 | No CR or DR found (returns positive value). | |
%%RM | A null string (''). | |
%%RV | The ending position of the return in string. This allows Enrichment to find multiple values in a single string through successive function calls. Sets %%RV to 0 if the end of string is reached. |
Examples
Function Call | Return | %%RC | %%RV |
---|---|---|---|
FINDNUM('Total: $ 21.43 Payment: $5',1, 2,1,$,',','.') | 2143 | 0 | 15 |
FINDNUM('Total: ($ 21.43) Payment: $5', 1,2,0,$,',','.') | -2143 | 0 | 17 |
FINDNUM('Total: $-21.43 Payment: $5',1, 2,0,$,',','.') | 0 | 12 | 9 |
FINDNUM('Total: L 2.123,32 DR',1,3,10,L, '.',',') | -2123320 | 0 | 0 |
FINDNUM('Total: ($ 21.43) Payment: $5', 17,2,0,$,',','.') | 500 | 0 | 0 |