當前位置: 首頁>>代碼示例>>Golang>>正文


Golang unicode.IsLetter函數代碼示例

本文整理匯總了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
}
開發者ID:fcavani,項目名稱:log,代碼行數:14,代碼來源:validate.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:8,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:tags,代碼行數:9,代碼來源:tags.go

示例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
}
開發者ID:fcavani,項目名稱:gormethods,代碼行數:9,代碼來源:auth.go

示例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
}
開發者ID:fcavani,項目名稱:gormethods,代碼行數:8,代碼來源:validate.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:11,代碼來源:validation.go

示例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
}
開發者ID:fcavani,項目名稱:tags,代碼行數:12,代碼來源:tags.go

示例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
}
開發者ID:fcavani,項目名稱:text,代碼行數:13,代碼來源:validation.go


注:本文中的github.com/fcavani/unicode.IsLetter函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。