forked from mtusi2026/mtusi2026lab2
14 lines
366 B
Go
14 lines
366 B
Go
package validate
|
|
|
|
import "fmt"
|
|
|
|
func MessageText(s string) error {
|
|
if !notOnlyWhitespace(s) {
|
|
return newError("text", "must not be empty or whitespace only")
|
|
}
|
|
if !codePointsBetween(s, MessageTextMinLen, MessageTextMaxLen) {
|
|
return newError("text", fmt.Sprintf("length must be in [%d, %d] code points", MessageTextMinLen, MessageTextMaxLen))
|
|
}
|
|
return nil
|
|
}
|