I am getting different strings, some are numbers, for example: "1", "afd76", "dddd", "521129" and "0.1423105". I need to check if they are valid numbers before I can continue. In the above examples all are numbers apart from "afd76" and "dddd".
isdigit and isnumeric wont do because they can only verify if the string is an int, for example:
"3".isdigit() is true but "3.0".isdigit() is false
"3".isnumeric() is true but "3.0".isnumeric() is false
Is there any elegant way to do this check other than force casting and deciding what to do depending on the exception?