Skip to content

Commit 532207e

Browse files
authored
Create Palindrome.lua
1 parent dd5948b commit 532207e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

strings/Palindrome.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)