package unicode

Import Path
	unicode (on golang.org and go.dev)

Dependency Relation
	imports 0 packages, and imported by 26 packages

Involved Source Files casetables.go digit.go graphic.go Package unicode provides data and functions to test some properties of Unicode code points. tables.go
Code Examples package main import ( "fmt" "unicode" ) func main() { fmt.Printf("%#U\n", unicode.SimpleFold('A')) // 'a' fmt.Printf("%#U\n", unicode.SimpleFold('a')) // 'A' fmt.Printf("%#U\n", unicode.SimpleFold('K')) // 'k' fmt.Printf("%#U\n", unicode.SimpleFold('k')) // '\u212A' (Kelvin symbol, K) fmt.Printf("%#U\n", unicode.SimpleFold('\u212A')) // 'K' fmt.Printf("%#U\n", unicode.SimpleFold('1')) // '1' } package main import ( "fmt" "unicode" ) func main() { t := unicode.TurkishCase const lci = 'i' fmt.Printf("%#U\n", t.ToLower(lci)) fmt.Printf("%#U\n", t.ToTitle(lci)) fmt.Printf("%#U\n", t.ToUpper(lci)) const uci = 'İ' fmt.Printf("%#U\n", t.ToLower(uci)) fmt.Printf("%#U\n", t.ToTitle(uci)) fmt.Printf("%#U\n", t.ToUpper(uci)) } package main import ( "fmt" "unicode" ) func main() { const lcG = 'g' fmt.Printf("%#U\n", unicode.To(unicode.UpperCase, lcG)) fmt.Printf("%#U\n", unicode.To(unicode.LowerCase, lcG)) fmt.Printf("%#U\n", unicode.To(unicode.TitleCase, lcG)) const ucG = 'G' fmt.Printf("%#U\n", unicode.To(unicode.UpperCase, ucG)) fmt.Printf("%#U\n", unicode.To(unicode.LowerCase, ucG)) fmt.Printf("%#U\n", unicode.To(unicode.TitleCase, ucG)) } package main import ( "fmt" "unicode" ) func main() { const ucG = 'G' fmt.Printf("%#U\n", unicode.ToLower(ucG)) } package main import ( "fmt" "unicode" ) func main() { const ucG = 'g' fmt.Printf("%#U\n", unicode.ToTitle(ucG)) } package main import ( "fmt" "unicode" ) func main() { const ucG = 'g' fmt.Printf("%#U\n", unicode.ToUpper(ucG)) } package main import ( "fmt" "unicode" ) func main() { // constant with mixed type runes const mixed = "\b5Ὂg̀9! ℃ᾭG" for _, c := range mixed { fmt.Printf("For %q:\n", c) if unicode.IsControl(c) { fmt.Println("\tis control rune") } if unicode.IsDigit(c) { fmt.Println("\tis digit rune") } if unicode.IsGraphic(c) { fmt.Println("\tis graphic rune") } if unicode.IsLetter(c) { fmt.Println("\tis letter rune") } if unicode.IsLower(c) { fmt.Println("\tis lower case rune") } if unicode.IsMark(c) { fmt.Println("\tis mark rune") } if unicode.IsNumber(c) { fmt.Println("\tis number rune") } if unicode.IsPrint(c) { fmt.Println("\tis printable rune") } if !unicode.IsPrint(c) { fmt.Println("\tis not printable rune") } if unicode.IsPunct(c) { fmt.Println("\tis punct rune") } if unicode.IsSpace(c) { fmt.Println("\tis space rune") } if unicode.IsSymbol(c) { fmt.Println("\tis symbol rune") } if unicode.IsTitle(c) { fmt.Println("\tis title case rune") } if unicode.IsUpper(c) { fmt.Println("\tis upper case rune") } } }
Package-Level Type Names (total 5)
/* sort by: | */
CaseRange represents a range of Unicode code points for simple (one code point to one code point) case conversion. The range runs from Lo to Hi inclusive, with a fixed stride of 1. Deltas are the number to add to the code point to reach the code point for a different case for that character. They may be negative. If zero, it means the character is in the corresponding case. There is a special case representing sequences of alternating corresponding Upper and Lower pairs. It appears with a fixed Delta of {UpperLower, UpperLower, UpperLower} The constant UpperLower has an otherwise impossible delta value. Delta d Hi uint32 Lo uint32
Range16 represents of a range of 16-bit Unicode code points. The range runs from Lo to Hi inclusive and has the specified stride. Hi uint16 Lo uint16 Stride uint16
Range32 represents of a range of Unicode code points and is used when one or more of the values will not fit in 16 bits. The range runs from Lo to Hi inclusive and has the specified stride. Lo and Hi must always be >= 1<<16. Hi uint32 Lo uint32 Stride uint32
RangeTable defines a set of Unicode code points by listing the ranges of code points within the set. The ranges are listed in two slices to save space: a slice of 16-bit ranges and a slice of 32-bit ranges. The two slices must be in sorted order and non-overlapping. Also, R32 should contain only values >= 0x10000 (1<<16). // number of entries in R16 with Hi <= MaxLatin1 R16 []Range16 R32 []Range32 func In(r rune, ranges ...*RangeTable) bool func Is(rangeTab *RangeTable, r rune) bool func IsOneOf(ranges []*RangeTable, r rune) bool var Adlam *RangeTable var Ahom *RangeTable var Anatolian_Hieroglyphs *RangeTable var Arabic *RangeTable var Armenian *RangeTable var ASCII_Hex_Digit *RangeTable var Avestan *RangeTable var Balinese *RangeTable var Bamum *RangeTable var Bassa_Vah *RangeTable var Batak *RangeTable var Bengali *RangeTable var Bhaiksuki *RangeTable var Bidi_Control *RangeTable var Bopomofo *RangeTable var Brahmi *RangeTable var Braille *RangeTable var Buginese *RangeTable var Buhid *RangeTable var C *RangeTable var Canadian_Aboriginal *RangeTable var Carian *RangeTable var Caucasian_Albanian *RangeTable var Cc *RangeTable var Cf *RangeTable var Chakma *RangeTable var Cham *RangeTable var Cherokee *RangeTable var Chorasmian *RangeTable var Co *RangeTable var Common *RangeTable var Coptic *RangeTable var Cs *RangeTable var Cuneiform *RangeTable var Cypriot *RangeTable var Cyrillic *RangeTable var Dash *RangeTable var Deprecated *RangeTable var Deseret *RangeTable var Devanagari *RangeTable var Diacritic *RangeTable var Digit *RangeTable var Dives_Akuru *RangeTable var Dogra *RangeTable var Duployan *RangeTable var Egyptian_Hieroglyphs *RangeTable var Elbasan *RangeTable var Elymaic *RangeTable var Ethiopic *RangeTable var Extender *RangeTable var Georgian *RangeTable var Glagolitic *RangeTable var Gothic *RangeTable var Grantha *RangeTable var Greek *RangeTable var Gujarati *RangeTable var Gunjala_Gondi *RangeTable var Gurmukhi *RangeTable var Han *RangeTable var Hangul *RangeTable var Hanifi_Rohingya *RangeTable var Hanunoo *RangeTable var Hatran *RangeTable var Hebrew *RangeTable var Hex_Digit *RangeTable var Hiragana *RangeTable var Hyphen *RangeTable var Ideographic *RangeTable var IDS_Binary_Operator *RangeTable var IDS_Trinary_Operator *RangeTable var Imperial_Aramaic *RangeTable var Inherited *RangeTable var Inscriptional_Pahlavi *RangeTable var Inscriptional_Parthian *RangeTable var Javanese *RangeTable var Join_Control *RangeTable var Kaithi *RangeTable var Kannada *RangeTable var Katakana *RangeTable var Kayah_Li *RangeTable var Kharoshthi *RangeTable var Khitan_Small_Script *RangeTable var Khmer *RangeTable var Khojki *RangeTable var Khudawadi *RangeTable var L *RangeTable var Lao *RangeTable var Latin *RangeTable var Lepcha *RangeTable var Letter *RangeTable var Limbu *RangeTable var Linear_A *RangeTable var Linear_B *RangeTable var Lisu *RangeTable var Ll *RangeTable var Lm *RangeTable var Lo *RangeTable var Logical_Order_Exception *RangeTable var Lower *RangeTable var Lt *RangeTable var Lu *RangeTable var Lycian *RangeTable var Lydian *RangeTable var M *RangeTable var Mahajani *RangeTable var Makasar *RangeTable var Malayalam *RangeTable var Mandaic *RangeTable var Manichaean *RangeTable var Marchen *RangeTable var Mark *RangeTable var Masaram_Gondi *RangeTable var Mc *RangeTable var Me *RangeTable var Medefaidrin *RangeTable var Meetei_Mayek *RangeTable var Mende_Kikakui *RangeTable var Meroitic_Cursive *RangeTable var Meroitic_Hieroglyphs *RangeTable var Miao *RangeTable var Mn *RangeTable var Modi *RangeTable var Mongolian *RangeTable var Mro *RangeTable var Multani *RangeTable var Myanmar *RangeTable var N *RangeTable var Nabataean *RangeTable var Nandinagari *RangeTable var Nd *RangeTable var New_Tai_Lue *RangeTable var Newa *RangeTable var Nko *RangeTable var Nl *RangeTable var No *RangeTable var Noncharacter_Code_Point *RangeTable var Number *RangeTable var Nushu *RangeTable var Nyiakeng_Puachue_Hmong *RangeTable var Ogham *RangeTable var Ol_Chiki *RangeTable var Old_Hungarian *RangeTable var Old_Italic *RangeTable var Old_North_Arabian *RangeTable var Old_Permic *RangeTable var Old_Persian *RangeTable var Old_Sogdian *RangeTable var Old_South_Arabian *RangeTable var Old_Turkic *RangeTable var Oriya *RangeTable var Osage *RangeTable var Osmanya *RangeTable var Other *RangeTable var Other_Alphabetic *RangeTable var Other_Default_Ignorable_Code_Point *RangeTable var Other_Grapheme_Extend *RangeTable var Other_ID_Continue *RangeTable var Other_ID_Start *RangeTable var Other_Lowercase *RangeTable var Other_Math *RangeTable var Other_Uppercase *RangeTable var P *RangeTable var Pahawh_Hmong *RangeTable var Palmyrene *RangeTable var Pattern_Syntax *RangeTable var Pattern_White_Space *RangeTable var Pau_Cin_Hau *RangeTable var Pc *RangeTable var Pd *RangeTable var Pe *RangeTable var Pf *RangeTable var Phags_Pa *RangeTable var Phoenician *RangeTable var Pi *RangeTable var Po *RangeTable var Prepended_Concatenation_Mark *RangeTable var Ps *RangeTable var Psalter_Pahlavi *RangeTable var Punct *RangeTable var Quotation_Mark *RangeTable var Radical *RangeTable var Regional_Indicator *RangeTable var Rejang *RangeTable var Runic *RangeTable var S *RangeTable var Samaritan *RangeTable var Saurashtra *RangeTable var Sc *RangeTable var Sentence_Terminal *RangeTable var Sharada *RangeTable var Shavian *RangeTable var Siddham *RangeTable var SignWriting *RangeTable var Sinhala *RangeTable var Sk *RangeTable var Sm *RangeTable var So *RangeTable var Soft_Dotted *RangeTable var Sogdian *RangeTable var Sora_Sompeng *RangeTable var Soyombo *RangeTable var Space *RangeTable var STerm *RangeTable var Sundanese *RangeTable var Syloti_Nagri *RangeTable var Symbol *RangeTable var Syriac *RangeTable var Tagalog *RangeTable var Tagbanwa *RangeTable var Tai_Le *RangeTable var Tai_Tham *RangeTable var Tai_Viet *RangeTable var Takri *RangeTable var Tamil *RangeTable var Tangut *RangeTable var Telugu *RangeTable var Terminal_Punctuation *RangeTable var Thaana *RangeTable var Thai *RangeTable var Tibetan *RangeTable var Tifinagh *RangeTable var Tirhuta *RangeTable var Title *RangeTable var Ugaritic *RangeTable var Unified_Ideograph *RangeTable var Upper *RangeTable var Vai *RangeTable var Variation_Selector *RangeTable var Wancho *RangeTable var Warang_Citi *RangeTable var White_Space *RangeTable var Yezidi *RangeTable var Yi *RangeTable var Z *RangeTable var Zanabazar_Square *RangeTable var Zl *RangeTable var Zp *RangeTable var Zs *RangeTable
SpecialCase represents language-specific case mappings such as Turkish. Methods of SpecialCase customize (by overriding) the standard mappings. ToLower maps the rune to lower case giving priority to the special mapping. ToTitle maps the rune to title case giving priority to the special mapping. ToUpper maps the rune to upper case giving priority to the special mapping. func bytes.ToLowerSpecial(c SpecialCase, s []byte) []byte func bytes.ToTitleSpecial(c SpecialCase, s []byte) []byte func bytes.ToUpperSpecial(c SpecialCase, s []byte) []byte func strings.ToLowerSpecial(c SpecialCase, s string) string func strings.ToTitleSpecial(c SpecialCase, s string) string func strings.ToUpperSpecial(c SpecialCase, s string) string var AzeriCase var TurkishCase
Package-Level Functions (total 21)
In reports whether the rune is a member of one of the ranges.
Is reports whether the rune is in the specified table of ranges.
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.
IsDigit reports whether the rune is a decimal digit.
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.
IsLetter reports whether the rune is a letter (category L).
IsLower reports whether the rune is a lower case letter.
IsMark reports whether the rune is a mark character (category M).
IsNumber reports whether the rune is a number (category N).
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.
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.
IsPunct reports whether the rune is a Unicode punctuation character (category P).
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.
IsSymbol reports whether the rune is a symbolic character.
IsTitle reports whether the rune is a title case letter.
IsUpper reports whether the rune is an upper case letter.
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. If r is not a valid Unicode code point, SimpleFold(r) returns r. For example: SimpleFold('A') = 'a' SimpleFold('a') = 'A' SimpleFold('K') = 'k' SimpleFold('k') = '\u212A' (Kelvin symbol, K) SimpleFold('\u212A') = 'K' SimpleFold('1') = '1' SimpleFold(-2) = -2
To maps the rune to the specified case: UpperCase, LowerCase, or TitleCase.
ToLower maps the rune to lower case.
ToTitle maps the rune to title case.
ToUpper maps the rune to upper case.
Package-Level Variables (total 248)
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
CaseRanges is the table describing case mappings for all letters with non-self mappings.
Categories is the set of Unicode category tables.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
FoldCategory maps a category name to a table of code points outside the category that are equivalent under simple case folding to code points inside the category. If there is no entry for a category name, there are no such points.
FoldScript maps a script name to a table of code points outside the script that are equivalent under simple case folding to code points inside the script. If there is no entry for a script name, there are no such points.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
GraphicRanges defines the set of graphic characters according to Unicode.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
PrintRanges defines the set of printable characters according to Go. ASCII space, U+0020, is handled separately.
Properties is the set of Unicode property tables.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
Scripts is the set of Unicode script tables.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
These variables have type *RangeTable.
Package-Level Constants (total 10)
Indices into the Delta arrays inside CaseRanges for case mapping.
const MaxASCII = 127 // maximum ASCII value.
Indices into the Delta arrays inside CaseRanges for case mapping.
const MaxLatin1 = 255 // maximum Latin-1 value.
const MaxRune = 1114111 // Maximum valid Unicode code point.
const ReplacementChar = 65533 // Represents invalid code points.
Indices into the Delta arrays inside CaseRanges for case mapping.
Indices into the Delta arrays inside CaseRanges for case mapping.
If the Delta field of a CaseRange is UpperLower, it means this CaseRange represents a sequence of the form (say) Upper Lower Upper Lower.
Version is the Unicode edition from which the tables are derived.