Documentation ¶
Overview ¶
Package unicodes implements unicode utility functions.
Package unicodes implements unicode utility functions.
Package unicodes implements unicode utility functions.
Package unicodes implements unicode utility functions.
Index ¶
- func In(r rune, ranges ...*unicode.RangeTable) bool
- func Is(rangeTab *unicode.RangeTable, r rune) bool
- func IsControl(r rune) bool
- func IsDigit(r rune) bool
- func IsGraphic(r rune) bool
- func IsHan(r rune) bool
- func IsLetter(r rune) bool
- func IsLower(r rune) bool
- func IsMark(r rune) bool
- func IsNumber(r rune) bool
- func IsOneOf(ranges []*unicode.RangeTable, r rune) bool
- func IsPrint(r rune) bool
- func IsPunct(r rune) bool
- func IsQuote(r rune) bool
- func IsSpace(r rune) bool
- func IsSymbol(r rune) bool
- func IsTitle(r rune) bool
- func IsUpper(r rune) bool
- func SimpleFold(r rune) rune
- func To(_case int, r rune) rune
- func ToLower(r rune) rune
- func ToTitle(r rune) rune
- func ToUpper(r rune) rune
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func In ¶
func In(r rune, ranges ...*unicode.RangeTable) bool
In reports whether the rune is a member of one of the ranges.
func Is ¶
func Is(rangeTab *unicode.RangeTable, r rune) bool
Is reports whether the rune is in the specified table of ranges.
func IsControl ¶
IsControl reports whether the rune is a control character. The C (Other) Unicode category includes more code points such as surrogates; use Is(C, r) to test for them.
func IsGraphic ¶
IsGraphic reports whether the rune is defined as a Graphic by Unicode. Such characters include letters, marks, numbers, punctuation, symbols, and spaces, from categories L, M, N, P, S, Zs.
func IsHan ¶
IsHan reports whether the rune is a Chinese characters.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/unicodes" ) func main() { fmt.Println(unicodes.IsHan('中')) fmt.Println(unicodes.IsHan('文')) fmt.Println(unicodes.IsHan('一')) fmt.Println(unicodes.IsHan('a')) fmt.Println(unicodes.IsHan('A')) fmt.Println(unicodes.IsHan('1')) fmt.Println(unicodes.IsHan(',')) fmt.Println(unicodes.IsHan(' ')) }
Output: true true true false false false false false
func IsOneOf ¶
func IsOneOf(ranges []*unicode.RangeTable, r rune) bool
IsOneOf reports whether the rune is a member of one of the ranges. The function "In" provides a nicer signature and should be used in preference to IsOneOf.
func IsPrint ¶
IsPrint reports whether the rune is defined as printable by Go. Such characters include letters, marks, numbers, punctuation, symbols, and the ASCII space character, from categories L, M, N, P, S and the ASCII space character. This categorization is the same as IsGraphic except that the only spacing character is ASCII space, U+0020.
func IsQuote ¶
IsQuote reports whether the rune is a quote. Returns true when the value of r is ' or " or `, otherwise it returns false.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/util/unicodes" ) func main() { fmt.Println(unicodes.IsQuote('"')) fmt.Println(unicodes.IsQuote('`')) fmt.Println(unicodes.IsQuote('\'')) fmt.Println(unicodes.IsQuote('a')) fmt.Println(unicodes.IsQuote('1')) fmt.Println(unicodes.IsQuote('A')) fmt.Println(unicodes.IsQuote('一')) fmt.Println(unicodes.IsQuote(' ')) }
Output: true true true false false false false false
func IsSpace ¶
IsSpace reports whether the rune is a space character as defined by Unicode's White Space property; in the Latin-1 space this is
'\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).
Other definitions of spacing characters are set by category Z and property Pattern_White_Space.
func SimpleFold ¶
SimpleFold iterates over Unicode code points equivalent under the Unicode-defined simple case folding. Among the code points equivalent to rune (including rune itself), SimpleFold returns the smallest rune > r if one exists, or else the smallest rune >= 0.
For example:
SimpleFold('A') = 'a' SimpleFold('a') = 'A' SimpleFold('K') = 'k' SimpleFold('k') = '\u212A' (Kelvin symbol, K) SimpleFold('\u212A') = 'K' SimpleFold('1') = '1'
Types ¶
This section is empty.