forked from mtusi2026/mtusi2026lab3
work 3
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user