com.scalacraft.domain.v2.country
A CountryCodeNumeric represents an ISO 3166 numeric country code.
CountryCodeNumeric
Details of the ISO 3166-1 numeric codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_numeric
Pattern matching is supported as illustrated by the following examples,
"343" match { case CountryCodeNumeric(code) => code // "343" case _ => None }
Invalid country codes will not be matched.
"44" match { case CountryCodeNumeric(code) => code case _ => None // None }
An implicit conversion is provided which allows an instance of CountryCodeNumeric to be used when a String is required.
String
def logCode(code: String) = println(s"code: $code") val cc = CountryCodeNumeric.opt("495").get logCode(cc) // "code: 495"
An implicit conversion to the unconstrained version of this class is also available.
A valid numeric country code
A
CountryCodeNumeric
represents an ISO 3166 numeric country code.Details of the ISO 3166-1 numeric codes can be found here: http://en.wikipedia.org/wiki/ISO_3166-1_numeric
Pattern Matching
Pattern matching is supported as illustrated by the following examples,
Invalid country codes will not be matched.
Implicit Conversions
An implicit conversion is provided which allows an instance of
CountryCodeNumeric
to be used when aString
is required.An implicit conversion to the unconstrained version of this class is also available.