Skip to content

sanestring small hours decimal

Dustin edited this page Mar 20, 2015 · 2 revisions

Checks if a string is a number of hours with or without a decimal point. The string must start with a number "0" through to "19" optionally followed by a "." and any number of digits. If there is a decimal place, there must be digits before and after it. If the string matches the pattern it is returned as a list of one item, if not then #f is returned.

Parameter Description
s The string to check

Examples

> (sanestring-small-hours-decimal "5.5")
("5.5")
> (sanestring-small-hours-decimal "19")
("19")
> (sanestring-small-hours-decimal "20")
#f
> (sanestring-small-hours-decimal "0.2")
("0.2")
> (sanestring-small-hours-decimal "4.")
#f
> (sanestring-small-hours-decimal ".5")
#f
> (sanestring-small-hours-decimal "16.253453")
("16.253453")
Clone this wiki locally