You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
418 B

package com.xsn.explorer.models
import com.alexitc.playsonify.models.WrappedString
class IPAddress (val string: String) extends WrappedString
object IPAddress {
private val pattern = "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$".r.pattern
def from(string: String): Option[IPAddress] = {
if (pattern.matcher(string).matches()) {
Some(new IPAddress(string))
} else {
None
}
}
}