-
Notifications
You must be signed in to change notification settings - Fork 0
Percentage
Giuseppe Cannella edited this page Feb 19, 2020
·
4 revisions
Type name | example |
---|---|
Percentage | 10% |
import com.github.gekomad.regexcollection.Percentage
import com.github.gekomad.regexcollection.Validate.validate
assert(validate[Percentage]("""10""") == None)
assert(validate[Percentage]("""101%""") == None)
assert(validate[Percentage]("""-10%""") == None)
assert(validate[Percentage]("""1.1%""") == None)
assert(validate[Percentage]("""0%""") == Some("""0%"""))
assert(validate[Percentage]("""10%""") == Some("""10%"""))
assert(validate[Percentage]("""100%""") == Some("""100%"""))
assert(validate[Percentage]("""99%""") == Some("""99%"""))
import com.github.gekomad.regexcollection.Percentage
import com.github.gekomad.regexcollection.Validate.findAll
assert(findAll[Percentage]("""dd 10% dg 55% """) == List("10%", "55%"))