Documentation
¶
Index ¶
- func GetPreinited(lang string) func(a, b string) bool
- func IndexString(name string) (less func(a, b string) bool)
- func Less(a, b string) bool
- func MakeFuncLess(lang ...string) func(a, b string) bool
- func Preinit(langs ...string)
- func SortStrings(arr []string, lang ...string)
- func SupportedLangs() []string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPreinited ¶
func IndexString ¶
IndexString returns a Less function that can be used to compare if string "a" is less than string "b". The "name" parameter should be a valid collate definition.
Examples of collation names
--------------------------------------------------------------------
ENGLISH, EN -- English
AMERICANENGLISH, EN-US -- English US
FRENCH, FR -- French
CHINESE, ZH -- Chinese
SIMPLIFIEDCHINESE, ZH-HANS -- Simplified Chinese
...
Case insensitive: add the CI tag to the name
--------------------------------------------------------------------
ENGLISH_CI
FR_CI
ZH-HANS_CI
...
Case sensitive: add the CS tag to the name
--------------------------------------------------------------------
ENGLISH_CS
FR_CS
ZH-HANS_CS
...
For numerics: add the NUM tag to the name
Specifies that numbers should sort numerically ("2" < "12")
--------------------------------------------------------------------
DUTCH_NUM
JAPANESE_NUM
...
For loosness: add the LOOSE tag to the name
Ignores diacritics, case and weight
--------------------------------------------------------------------
JA_LOOSE
CHINESE_LOOSE
...
Example ¶
var nameA = "Miller"
var nameB = "anderson"
less := IndexString("ENGLISH_CI")
fmt.Printf("%t\n", less(nameA, nameB))
fmt.Printf("%t\n", less(nameB, nameA))
Output: false true
func MakeFuncLess ¶ added in v1.2.0
func SortStrings ¶
func SupportedLangs ¶
func SupportedLangs() []string
SupportedLangs returns all of the languages that Index() supports.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.