Palindrome detection: Difference between revisions

Content added Content deleted
No edit summary
Line 5,388: Line 5,388:
=={{header|Run BASIC}}==
=={{header|Run BASIC}}==
<syntaxhighlight lang="runbasic">data "My dog has fleas", "Madam, I'm Adam.", "1 on 1", "In girum imus nocte et consumimur igni"
<syntaxhighlight lang="runbasic">data "My dog has fleas", "Madam, I'm Adam.", "1 on 1", "In girum imus nocte et consumimur igni"

for i = 1 to 4
for i = 1 to 4
read w$
read w$
print w$;" is ";isPalindrome$(w$);" Palindrome"
print w$;" is ";isPalindrome$(w$);" Palindrome"
next
next

FUNCTION isPalindrome$(str$)
function isPalindrome$(str$)
for i = 1 to len(str$)
for i = 1 to len(str$)
a$ = upper$(mid$(str$,i,1))
a$ = upper$(mid$(str$,i,1))
if (a$ >= "A" and a$ <= "Z") or (a$ >= "0" and a$ <= "9") then b$ = b$ + a$: c$ = a$ + c$
if (a$ >= "A" and a$ <= "Z") or (a$ >= "0" and a$ <= "9") then b$ = b$ + a$: c$ = a$ + c$
next i
next i
if b$ <> c$ then isPalindrome$ = "not"</syntaxhighlight>
if b$ <> c$ then isPalindrome$ = "not"
end function</syntaxhighlight>
{{out}}
{{out}}
<pre>My dog has fleas is not Palindrome
<pre>My dog has fleas is not Palindrome