validator/string
Functions
is_email
pub fn is_email( error: a, ) -> fn(String) -> Result(String, tuple(a, List(a)))
Validate if a string is an email.
This checks if a string follows a simple pattern _@_
.
is_float
pub fn is_float( error: a, ) -> fn(String) -> Result(Float, tuple(a, List(a)))
Validate if a string parses to an Float. Returns the Float if so.
is_int
pub fn is_int( error: a, ) -> fn(String) -> Result(Int, tuple(a, List(a)))
Validate if a string parses to an Int. Returns the Int if so.
is_not_empty
pub fn is_not_empty( error: a, ) -> fn(String) -> Result(String, tuple(a, List(a)))
Validate if a string is not empty
max_length
pub fn max_length( error: a, max: Int, ) -> fn(String) -> Result(String, tuple(a, List(a)))
Validate the max length of a string
min_length
pub fn min_length( error: a, min: Int, ) -> fn(String) -> Result(String, tuple(a, List(a)))
Validate the min length of a string