strcmp: String Comparison

Description Usage Arguments Details Value See Also Examples

Description

Compare two strings or character vectors for equality.

Usage

1
2
strcmp(s1, s2)
strcmpi(s1, s2)

Arguments

s1, s2

character strings or vectors

Details

For strcmp comparisons are case-sensitive, while for strcmpi the are case-insensitive. Leading and trailing blanks do count.

Value

logical, i.e. TRUE if s1 and s2 have the same length as character vectors and all elements are equal as character strings, else FALSE.

See Also

strcat

Examples

1
2
strcmp(c("yes", "no"), c("yes", "no"))
strcmpi(c("yes", "no"), c("Yes", "No"))


Search within the pracma package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.