stringi (version 1.7.6)

stri_trans_char: Translate Characters

Description

Translates Unicode code points in each input string.

Usage

stri_trans_char(str, pattern, replacement)

Value

Returns a character vector.

Arguments

str

character vector

pattern

a single character string providing code points to be translated

replacement

a single character string giving translated code points

Author

Marek Gagolewski and other contributors

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)).

See Also

The official online manual of stringi at https://stringi.gagolewski.com/

Other transform: stri_trans_general(), stri_trans_list(), stri_trans_nfc(), stri_trans_tolower()

Examples

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

Run the code above in your browser using DataCamp Workspace