1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{str_diff}
\alias{str_diff}
\title{Finding Differences Between Strings}
\usage{
str_diff(x, y)
}
\arguments{
\item{x}{a single string}
\item{y}{a single string}
}
\value{
an integer vector containing the index of all mis-matched characters
in the first string.
}
\description{
Computes which characters differ between two strings.
}
\examples{
# strings to compare
x <- "once upon a time"
y <- "once upon a time there was"
z <- "once upon two times"
# diff: x - y
d <- str_diff(x, y)
d
str(d)
# other comparisons
str_diff(y, x)
str_diff(x, x)
str_diff(x, z)
str_diff(y, z)
}
|