Given a number as input, determine how many significant figures it has. This number will should be taken as a string because you have to do some special formatting. You'll see what I mean soon (I think).
A digit is a sig-fig if at least one of the following apply:
- Non-zero digits are always significant.
- Any zeros between two significant digits are significant.
- final zero or trailing zeros in the decimal portion only are significant.
- all digits are significant if nothing follows the decimal place.
- when there are only zeroes, all but the last zero are considered leading zeroes
A string or string array of the number. It might have a decimal point at the end without a digit after it. It might not have a decimal point at all.
How many sig-figs there are.
1.240 -> 4 0. -> 1 83900 -> 3 83900.0 -> 6 0.025 -> 2 0.0250 -> 3 2.5 -> 2 970. -> 3 0.00 -> 1