Palindrome detection: Difference between revisions
Content added Content deleted
(→{{header|Java}}: Added a more efficient non-recursive Java solution that also handles upper-plane Unicode characters.) |
m (→{{header|REXX}}: added a comment, used a template for an output section..) |
||
Line 4,516: | Line 4,516: | ||
isTpal: return reverse(arg(1))==arg(1) |
isTpal: return reverse(arg(1))==arg(1) |
||
isPal: return isTpal(translate(space(x,0)))</lang> |
isPal: return isTpal(translate(space(x,0)))</lang> |
||
{{out|output|text=''':'''}} |
|||
'''output''' |
|||
<pre> |
<pre> |
||
string = In girum imus nocte et consumimur igni |
string = In girum imus nocte et consumimur igni |
||
Line 4,522: | Line 4,522: | ||
</pre> |
</pre> |
||
=== |
=== version 2 === |
||
{{works with|ARexx}} |
{{works with|ARexx}} |
||
{{works with|Regina}} (3.8 and later, with options: AREXX_BIFS and AREXX_SEMANTICS) |
{{works with|Regina}} (3.8 and later, with options: AREXX_BIFS and AREXX_SEMANTICS) |
||
Line 4,531: | Line 4,531: | ||
<br>Use the '''PARSE UPPER''' statement or '''TRANSLATE()''' BIF instead. |
<br>Use the '''PARSE UPPER''' statement or '''TRANSLATE()''' BIF instead. |
||
<lang REXX> |
<lang REXX> |
||
/* REXX */ |
|||
/*Check whether a string is a palindrome */ |
/*Check whether a string is a palindrome */ |
||
parse pull string |
parse pull string |