Description Usage Arguments Details Value See Also Examples
These functions may be used to determine if two strings are equal (this is performed more intelligently than you may expect at a first glance) or to check whether they appear in a specific lexicographic order.
1 2 3 | stri_compare(e1, e2, opts_collator = list())
stri_cmp(e1, e2, opts_collator = list())
|
e1 |
character vector |
e2 |
character vector |
opts_collator |
a named list as generated with
|
stri_cmp is an alias to stri_compare. They both do the same operation.
Vectorized over e1
and e2
.
For more information on ICU's Collator and how to
tune it up in stringi, refer to
stri_opts_collator
. Please note that
different locale settings may lead to different results
(see the examples below).
Each function returns an integer vector with comparison
results of corresponding pairs of elements from e1
and e2
: -1
if e1[...] < e2[...]
,
0
if they are equal, and 1
if greater.
Other locale_sensitive: 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
1 2 3 4 5 6 7 8 9 | ## Not run:
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'
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.