Last chance! 50% off unlimited learning
Sale ends in
stri_compare(e1, e2, opts_collator = list())stri_cmp(e1, e2, opts_collator = list())
stri_opts_collator
with Collator's options,
or NA
for dummy Unicode code point comparisone1
and e2
: -1
if e1[...] < e2[...]
,
0
if they are equal, and 1
if greater.Vectorized over e1
and e2
.
For more information on stri_opts_collator
. Please note that
different locale settings may lead to different results
(see the examples below).
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_opts_collator
; 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
stri_cmp("hladny", "chladny", stri_opts_collator(locale="pl_PL")) # in Polish ch < h
stri_cmp("hladny", "chladny", stri_opts_collator(locale="sk_SK")) # in Slovak ch > h
stri_cmp("hladny", "HLADNY") # < or > (depends on locale)
stri_cmp("hladny", "HLADNY", stri_opts_collator(strength=2)) # ==
stri_cmp("hladn\u00FD", "hladny", stri_opts_collator(strength=1, locale="sk_SK")) # ==
stri_cmp(stri_enc_nfkd('\u0105'), '\u105') # but cf. stri_enc_nfkd('\u0105') != '\u105'
Run the code above in your browser using DataLab