Learn R Programming

stringi (version 1.8.3)

stri_reverse: Reverse Each String

Description

Reverses the order of the code points in every string.

Usage

stri_reverse(str)

Value

Returns a character vector.

Arguments

str

character vector

Author

Marek Gagolewski and other contributors

Details

Note that this operation may result in non-Unicode-normalized strings and may give peculiar outputs for bidirectional strings.

See also stri_rand_shuffle for a random permutation of code points.

See Also

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

Gagolewski M., stringi: Fast and portable character string processing in R, Journal of Statistical Software 103(2), 2022, 1-59, tools:::Rd_expr_doi("10.18637/jss.v103.i02")

Examples

Run this code
stri_reverse(c('123', 'abc d e f'))
stri_reverse('ZXY (\u0105\u0104123$^).')
stri_reverse(stri_trans_nfd('\u0105')) == stri_trans_nfd('\u0105') # A, ogonek -> agonek, A

Run the code above in your browser using DataLab