3.5.7.32 NumExtract

Description

This function takes a mixed string "str$" and returns the count-th consecutive digit block. If count is omitted it defaults to 1 (i.e. return the first block).

Syntax

 string NumExtract(string str$[, int count])$

Parameters

str$

is a string from which to extract number(s).

count

is a integer specifying the nth digit block to extract. It is optional. Default is 1, which means return the first digital block in the string str$. count = 0 returns the last block.

Return

Returns the count-th consecutive digit block in str$.

Example

numextract("1-413-586-2013",2)$=; //should return 413
numextract("1-413-586-2013",0)$=; //should return 2013

numextract("Jan-12")=; //should return 12, "-" in a string will not be treated as minus sign

See Also

NumBreak