ExtractNumber
ExtractNumber returns the numeric characters from a string.
Decimal points and negative signs are also returned.
If the first character is a zero(0), this will not be returned.
Declaration: Function ExtractNumber( const S : string) : Double;
Example
procedure OnMapEvent(var Value:Variant);begin Value := ExtractNumber('ab12.3de4'); //result is 12.34 Value := ExtractNumber('ABC123'); //result is 123 Value := ExtractNumber('$-123.05'); //result is -123.05 Value := ExtractNumber('The total was $-12,663.05'); //result is -12663.05 Value := ExtractNumber('02 indicates the 2nd day.'); //result is 22 LogInfo(FloatToStr(ExtractNumber('$5,232.46'))); // returns 5232.46 LogInfo(FloatToStr(ExtractNumber('-$5,232.46'))); // returns -5232.46 LogInfo(FloatToStr(ExtractNumber('ab86.9b6'))); // returns 86.96 LogInfo(FloatToStr(ExtractNumber('xyz123.67abc'))); // returns 123.67 LogInfo(FloatToStr(ExtractNumber('ww987$#()'))); // returns 987 end;