I want to check if some value (i.e: 42 or 41.0005) is a number in ECL (HPCC). I have in mind a function using Regular Expressions like this:
EXPORT IsNumeric(STRING UniqueID) := FUNCTION
regex:='^\\d+$';
RETURN REGEXFIND(regex, UniqueID);
END;
Is there a built-in IsNumeric function?
If not... Is there any better way of doing it than using regex? (Thinking both in readability and performance)
- Maybe an ECL command?
- STD function?
- Casting?
- #GetDataType?
- str.filter?
NOTE: Seems that in old versions of HPCC (2011) such function did not exist. But many releases have happened since then.