Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stri_trans_char

Translate Characters


Description

Translates Unicode code points in each input string.

Usage

stri_trans_char(str, pattern, replacement)

Arguments

str

character vector

pattern

a single character string providing code points to be translated

replacement

a single character string giving translated code points

Details

Vectorized over str and with respect to each code point in pattern and replacement.

If pattern and replacement consist of a different number of code points, then the extra code points in the longer of the two are ignored, with a warning.

If code points in a given pattern are not unique, the last corresponding replacement code point is used.

Time complexity for each string in str is O(stri_length(str)*stri_length(pattern)).

Value

Returns a character vector.

See Also

Examples

stri_trans_char('id.123', '.', '_')
stri_trans_char('babaab', 'ab', '01')
stri_trans_char('GCUACGGAGCUUCGGAGCUAG', 'ACGT', 'TGCA')

stringi

Character String Processing Facilities

v1.6.1
file LICENSE
Authors
Marek Gagolewski [aut, cre, cph] (<https://orcid.org/0000-0003-0637-6028>), Bartek Tartanus [ctb], and others (stringi source code); IBM, Unicode, Inc. and others (ICU4C source code, Unicode Character Database)
Initial release
2021-05-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.