Learn R Programming

stringfish (version 0.19.2)

string_identical: string_identical

Description

Compare strings semantically or exactly

Usage

string_identical(x, y, mode = c("semantic", "exact"))

Value

TRUE if strings are identical under the selected comparison mode

Arguments

x

A character vector

y

Another character vector to compare to x

mode

Either `"semantic"` to compare text after normalizing non-byte strings to UTF-8, or `"exact"` to additionally require matching encoding. Strings marked as `"bytes"` are always compared exactly.

See Also

identical

Examples

Run this code
x <- "fa\xE7ile"
Encoding(x) <- "latin1"
y <- iconv(x, "latin1", "UTF-8")
identical(x, y) # TRUE
string_identical(x, y) # TRUE
string_identical(x, y, mode = "exact") # FALSE

Run the code above in your browser using DataLab