Micro check library in Golang.
go get github.com/alioygur/is
It works with runes as long as is it possible.
Part of source code;
// Alpha check if the string contains only letters (a-zA-Z). Empty string is valid.
func Alpha(s string) bool {
for _, v := range s {
if ('Z' < v || v < 'A') && ('z' < v || v < 'a') {
return false
}
}
return true
}
package main
import "github.com/alioygur/is"
import "log"
func main() {
is.Email("jhon@example.com") // true
is.Numeric("Ⅸ") // false
is.UTFNumeric("Ⅸ") // true
}
for more documentation godoc
we are waiting your contribution
- Report problems
- Add/Suggest new features/recipes
- Improve/fix documentation
Many thanks to our contributors: contributors
I use code/got inspiration from these excellent libraries:
- arasatasaygin/is.js Micro check library
- asaskevich/govalidator [Go] Package of validators and sanitizers for strings, numerics, slices and structs