We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd5948b commit 532207eCopy full SHA for 532207e
strings/Palindrome.lua
@@ -0,0 +1,10 @@
1
+-- Author: JoshSCF
2
+-- Checks whether a string is a palindrome
3
+
4
+function IsPalindrome(String)
5
+ local NewString = String:upper() -- Convert string to uppercase so there isn't a case sensitivity problem
6
7
+ return NewString1 == NewString2:reverse() -- Returns true/false depending on whether one string is a palindrome of another
8
+end
9
10
+print(IsPalindrome("racecaR")) -- Returns true
0 commit comments