In R, you can use the ==
operator to check if two strings are equal.
In this example,
str1
and str2
with the same value "Hello"
.str1 == str2
, which will return TRUE
if they are equal, and FALSE
otherwise.str1 <- 'Hello'
str2 <- 'Hello'
result <- str1 == str2
print(paste('Are strings equal?', result))
[1] "Are strings equal? TRUE"
In this tutorial, we learned How to check if Two Strings are Equal in R language with well detailed examples.