Learn R Programming

stringi (version 1.5.3)

stri_sort_key: Sort Keys

Description

This function computes a locale-dependent 'sort key', which is an alternative character representation of the string that, when ordered in the C locale (which orders using bytes directly), will give an equivalent ordering to the original string. It is useful for enhancing algorithms that sort only in the C locale with the ability to be locale-aware.

Usage

stri_sort_key(str, ..., opts_collator = NULL)

Arguments

str

a character vector

...

additional settings for opts_collator

opts_collator

a named list with ICU Collator's options, see stri_opts_collator, NULL for default collation options

Value

The result is a character vector with the same length as str that contains the sort keys.

Details

For more information on ICU's Collator and how to tune it up in stringi, refer to stri_opts_collator.

References

Collation - ICU User Guide, http://userguide.icu-project.org/collation

See Also

Other locale_sensitive: %s<%(), about_locale, about_search_boundaries, about_search_coll, stri_compare(), stri_count_boundaries(), stri_duplicated(), stri_enc_detect2(), stri_extract_all_boundaries(), stri_locate_all_boundaries(), stri_opts_collator(), stri_order(), stri_sort(), stri_split_boundaries(), stri_trans_tolower(), stri_unique(), stri_wrap()

Examples

Run this code
# NOT RUN {
stri_sort_key(c('hladny', 'chladny'), locale='pl_PL')
stri_sort_key(c('hladny', 'chladny'), locale='sk_SK')
# }

Run the code above in your browser using DataLab