Skip to contents

Reverses each element of a character vector.

Usage

strRev(x)

Arguments

x

a character vector

Value

A character vector with each string reversed.

Details

This function uses stringi::stri_reverse(), which correctly handles Unicode characters and multi-byte encodings.

See also

stringi::stri_reverse()

string-overview for an overview of all string utilities in pharos.

Examples

strRev("abc")
#> [1] "cba"

strRev(c("hello", "world"))
#> [1] "olleh" "dlrow"

# Unicode-safe
strRev("äöü")
#> [1] "üöä"