Palindrome detection: Difference between revisions
m
→{{header|R}}: Improved syntax.
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
ReeceGoding (talk | contribs) m (→{{header|R}}: Improved syntax.) |
||
Line 4,512:
Unicode is supported, but this ignores the "inexact palindromes" extra credit requirement because, without some sort of regex, supporting Unicode while stripping punctuation and white space is hard in R.
<lang rsplus>is.Palindrome <- function(string)
{
characters <- unlist(strsplit(string, ""))
all(characters == rev(characters))
}</lang>
{{out}}
|