本文整理匯總了Golang中github.com/fcavani/unicode.IsLetter函數的典型用法代碼示例。如果您正苦於以下問題:Golang IsLetter函數的具體用法?Golang IsLetter怎麽用?Golang IsLetter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IsLetter函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ValProbeName
func ValProbeName(name string) error {
if len(name) < MinProbeName || len(name) > MaxProbeName {
return e.New(text.ErrInvNumberChars)
}
if !uni.IsLetter(int32(name[0])) {
return e.New(ErrFirstChar)
}
for _, v := range name {
if !uni.IsLetter(v) && !unicode.IsDigit(v) {
return e.Push(e.New(text.ErrInvCharacter), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例2: CheckDomain
func CheckDomain(domain string) error {
for _, v := range domain {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '.' {
return e.Push(e.New("invalid domain name"), e.New("the character '%v' in redirect is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例3: CheckTag
// Check if a tag is formed with the corrects characters
func CheckTag(tag string) error {
for _, v := range tag {
if !u.IsLetter(v) && !unicode.IsDigit(v) && v != ' ' && v != '-' && v != '_' && v != '.' && v != '/' && v != ':' {
return e.Push(e.New(ErrInvalidTagChar), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例4: CheckHash
// CheckHash the hash of a password.
func CheckHash(name string) error {
for _, v := range name {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '-' && v != '_' && v != '.' && v != '=' {
return e.Push(e.New(text.ErrInvCharacter), e.New("the character '%v' in instance name is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例5: CheckObjectName
func CheckObjectName(name string) error {
for _, v := range name {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '-' && v != '_' && v != '*' && v != '{' && v != '}' && v != '/' && v != '.' && v != '[' && v != ']' {
return e.Push(e.New(text.ErrInvCharacter), e.New("the character '%v' in object name is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例6: CheckText
func CheckText(text string, min, max int) error {
if len(text) < min || len(text) > max {
return e.New(ErrInvNumberChars)
}
for _, v := range text {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '\n' && v != ' ' && v != '`' && v != '~' && v != '!' && v != '@' && v != '#' && v != '$' && v != '%' && v != '^' && v != '&' && v != '*' && v != '(' && v != ')' && v != '_' && v != '-' && v != '+' && v != '=' && v != '{' && v != '}' && v != '[' && v != ']' && v != '|' && v != '\\' && v != ':' && v != ';' && v != '"' && v != '\'' && v != '?' && v != '/' && v != ',' && v != '.' {
return e.Push(e.New(ErrInvCharacter), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例7: CheckLettersNumber
func CheckLettersNumber(text string, min, max uint64) error {
if uint64(len(text)) < min || uint64(len(text)) > max {
return e.New(ErrInvNumberChars)
}
for _, v := range text {
if !uni.IsLetter(v) && !unicode.IsDigit(v) {
return e.Push(e.New(ErrInvCharacter), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例8: CheckLetters
func CheckLetters(text string, min, max int) error {
if len(text) < min || len(text) > max {
return e.New(ErrInvNumberChars)
}
for _, v := range text {
if !uni.IsLetter(v) {
return e.Push(e.New(ErrInvCharacter), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例9: CheckUrl
func CheckUrl(rawurl string, min, max int) error {
if len(rawurl) < min || len(rawurl) > max {
return e.Push(e.New(ErrInvUrl), e.New("invalid url length"))
}
for _, v := range rawurl {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '/' && v != ':' && v != '[' && v != ']' && v != '?' && v != '@' && v != '.' && v != '-' && v != '_' && v != ' ' && v != '+' && v != '%' && v != '#' {
return e.Push(e.New(ErrInvUrl), e.New("the character '%v' in redirect is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例10: CheckSearch
func CheckSearch(query string, min, max int) error {
if len(query) < min || len(query) > max {
return e.New(ErrInvNumberChars)
}
for _, v := range query {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != '@' && v != '.' && v != '-' && v != '_' && v != ' ' && v != '+' && v != '"' {
return e.New(ErrInvCharacter)
}
}
return nil
}
示例11: CheckNameWithoutSpecials
func CheckNameWithoutSpecials(name string, min, max int) error {
if len(name) < min || len(name) > max {
return e.New(ErrInvNumberChars)
}
for _, v := range name {
if !uni.IsLetter(v) && !unicode.IsDigit(v) && v != ' ' && v != '&' && v != '(' && v != ')' && v != '-' && v != ':' && v != '/' && v != ',' && v != '.' && v != '_' {
return e.Push(e.New(ErrInvCharacter), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例12: CheckTags
// Check if a set of tags are correctly formated.
func CheckTags(tags string) error {
if len(tags) <= TagStringMin && len(tags) >= TagStringMax {
return e.New(ErrInvalidTagsLength)
}
for _, v := range tags {
if !u.IsLetter(v) && !unicode.IsDigit(v) && v != ',' && v != ' ' && v != '-' && v != '_' && v != '.' && v != '/' && v != ':' {
return e.Push(e.New(ErrInvalidTagChar), e.New("the character '%v' is invalid", string([]byte{byte(v)})))
}
}
return nil
}
示例13: ValidateRedirect
func ValidateRedirect(redirect string, min, max int) error {
utf8name := utf8string.NewString(redirect)
len := utf8name.RuneCount()
if len < min || len > max {
return e.New(e.ErrInvalidLength)
}
for _, s := range utf8name.Slice(1, len) {
if !uni.IsLetter(s) && !unicode.IsDigit(s) && s != '/' && s != '-' && s != '_' && s != '?' && s != '&' && s != '=' && s != '%' && s != '*' && s != '+' && s != ' ' && s != ',' {
return e.Push(e.New("the character '%v' in redirect is invalid", string([]byte{byte(s)})), e.New("invalid redirect"))
}
}
return nil
}