Description Usage Arguments Details Value References See Also Examples
A convenience function to tune the Collator's behavior,
e.g. in stri_compare
,
stri_order
, stri_detect_fixed
,
and other stringi-search-fixed functions.
1 2 3 |
locale |
single string, |
strength |
single integer in {1,2,3,4}, which
defines collation strength; |
alternate_shifted |
single logical value;
|
french |
single logical value; used in Canadian
French; |
uppercase_first |
single logical value; |
case_level |
single logical value; controls whether an extra case level (positioned before the third level) is generated or not |
normalization |
single logical value; if
|
numeric |
single logical value; when turned on, this attribute generates a collation key for the numeric value of substrings of digits; This is a way to get '100' to sort AFTER '2'. |
ICU's collator performs a locale-aware, natural-language alike string comparison. This is a more reliable way of establishing relationships between string than that provided by base R, and definitely one that is more complex than ordinary byte-comparison.
A note on collation strength
: generally,
strength
set to 4 is the least permissive. Set to 2
to ignore case differences. Set to 1 to also ignore
diacritical differences.
The strings are Unicode-normalized before the comparison.
Returns a named list object; missing options are left with default values.
Collation – ICU User Guide, http://userguide.icu-project.org/collation
ICU Collation Service Architecture – ICU User Guide, http://userguide.icu-project.org/collation/architecture
icu::Collator
Class Reference – ICU4C API
Documentation,
http://www.icu-project.org/apiref/icu4c/classicu_1_1Collator.html
Other locale_sensitive: stri_cmp
,
stri_compare
; stri_count_fixed
;
stri_detect_fixed
;
stri_enc_detect2
;
stri_locate_all_fixed
,
stri_locate_all_fixed,
,
stri_locate_first_fixed
,
stri_locate_first_fixed,
,
stri_locate_last_fixed
,
stri_locate_last_fixed
;
stri_order
, stri_sort
;
stri_replace_all_fixed
,
stri_replace_all_fixed
,
stri_replace_first_fixed
,
stri_replace_first_fixed
,
stri_replace_last_fixed
,
stri_replace_last_fixed
;
stri_split_fixed
,
stri_split_fixed
;
stri_trans_tolower
,
stri_trans_totitle
,
stri_trans_toupper
;
stringi-locale
;
stringi-search-fixed
Other search_fixed: stri_count_fixed
;
stri_detect_fixed
;
stri_extract_all_fixed
,
stri_extract_all_fixed,
,
stri_extract_first_fixed
,
stri_extract_first_fixed,
,
stri_extract_last_fixed
,
stri_extract_last_fixed
;
stri_locate_all_fixed
,
stri_locate_all_fixed,
,
stri_locate_first_fixed
,
stri_locate_first_fixed,
,
stri_locate_last_fixed
,
stri_locate_last_fixed
;
stri_replace_all_fixed
,
stri_replace_all_fixed
,
stri_replace_first_fixed
,
stri_replace_first_fixed
,
stri_replace_last_fixed
,
stri_replace_last_fixed
;
stri_split_fixed
,
stri_split_fixed
;
stringi-search-fixed
;
stringi-search
1 2 3 4 5 6 | ## Not run:
stri_cmp("zupa100", "zupa2") != stri_cmp("zupa100", "zupa2", stri_opts_collator(numeric=TRUE))
stri_cmp("above mentioned", "above-mentioned")
stri_cmp("above mentioned", "above-mentioned", stri_opts_collator(alternate_shifted=TRUE))
## End(Not run)
|
[1] TRUE
[1] -1
[1] -1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.