Home Search

DriveWorks Pro 22
ExtractNumber

Send Feedback

ExtractNumber

Gets the number found in the specified value.

Syntax

ExtractNumber([Value],[Index (optional)])

Where:

Value The value to find the number in

Index (optional) Which of the numbers found to return. A negative number searches backwards (from the end of the text). Omitted returns the first number found.

Examples

RuleMeaning
ExtractNumber("MyControl2")Will extract 2 from the text MyControl2
ExtractNumber(MyName())When applied to a variable named Value2, will extract 2 from the variable name.
ExtractNumber(MyName(),2)When applied to a variable named 10Value24, will extract 24 (the 2nd number found) from the variable name.
ExtractNumber("02/28/16",-1)Will extract 16 (the first number found from the end of the text) from the variable text.

DriveWorks versions earlier than 15 SP2

The result of this function will be returned as a string.

If you are using the result in a comparison argument please consider using the function Number to convert the result into a number.

For example:

If(Number(ExtractNumber("MyControl27Return"))<30,"Less Than","More Than")

From DriveWorks 15 SP2 and newer

The result of the function ExtractNumber does not require conversion, for example:

If(ExtractNumber("MyControl27Return"))<30,"Less Than","More Than")