#1 2021-11-17 16:08:19

wxinix
Member
Registered: 2020-09-07
Posts: 121

Does mORMOt have a better way for checking if str can be converted num

I know I can use TryStrToFloat, but is there any other (better, and faster) way provided by mORMot,  to check if a string can be converted to number?

Offline

#2 2021-11-17 20:11:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Does mORMOt have a better way for checking if str can be converted num

GetExtended() or GetInteger() or GetInt64() have overloaded versions which returns an error integer index, which is 0 if the UTF-8 text is a number.

You also have some other functions in the variants part of the framework, if you need to identify if some text is integer/currency/double or something else.

Offline

Board footer

Powered by FluxBB