How to check decimal point when string check is a valid number?
I think I'm using something like the following, but adding code to check the decimal point!
isNumber :: String -> Bool
isNumber xs = all isDigit xs || add extra code here
If a real number is defined in the EBNF as:
number -> .digit+ | digit+ [ .digit*]
For example, .5, 1.5, 1, 1. all valid numbers. + means one or more occurrences, and * means zero or more.
source
share