Documentation ¶
Overview ¶
Package text provides string replacers for Cyrillic / Gaj's Latin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Azbuka, the Serbian Cyrillic alphabet. Azbuka = func(m map[rune]rune) []rune { ret := []rune{} for k := range m { ret = append(ret, k) } return ret }(cyr2lat) // ToLatin is a Cyrillic to Latin string replacer. // Uses Unicode digraphs so the result can be transliterated back. // Upper-case is translated to mixed-case digraphs. Use strings.ToUpper() to convert to all-caps. ToLatin = strings.NewReplacer(func(m map[rune]rune) []string { ret := []string{} for k, v := range m { ret = append(ret, strings.ToUpper(string(k)), strings.ToTitle(string(v))) ret = append(ret, strings.ToLower(string(k)), strings.ToLower(string(v))) } return ret }(cyr2lat)...) // ToASCII transliterates text to ASCII. // This should only be used to generate e.g. web-safe filenames. ToASCII = strings.NewReplacer(func(m map[rune]string) []string { ret := []string{} for k, v := range m { ret = append(ret, strings.ToUpper(string(k)), strings.ToTitle(v)) ret = append(ret, strings.ToLower(string(k)), strings.ToLower(v)) } return ret }(ascii)...) // RemoveDigraphs removes digraphs from the text. // E.g. the digraph 'dž' becomes two characters: 'd' followed by 'ž'. RemoveDigraphs = strings.NewReplacer(func(m map[rune]string) []string { ret := []string{} for k, v := range m { ret = append(ret, strings.ToUpper(string(k)), strings.ToUpper(v)) ret = append(ret, strings.ToTitle(string(k)), strings.ToTitle(v)) ret = append(ret, strings.ToLower(string(k)), strings.ToLower(v)) } return ret }(digraphs)...) )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.