Palindrome detection: Difference between revisions
Content added Content deleted
(Picat: forgot the strip/1 function.) |
No edit summary |
||
Line 5,493: | Line 5,493: | ||
{{out}} |
{{out}} |
||
<pre>True</pre> |
<pre>True</pre> |
||
=={{header|Vlang}}== |
|||
<lang javascript>fn is_pal(ss string) bool { |
|||
s := ss.runes() |
|||
for i in 0..s.len/2 { |
|||
if s[i] != s[s.len-1-i]{ |
|||
return false |
|||
} |
|||
} |
|||
return true |
|||
} |
|||
fn main() { |
|||
for word in ["rotor", "rosetta", "step on no pets", "été", "wren", "🦊😀🦊"] { |
|||
println('$word => ${is_pal(word)}') |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre> |
|||
Are the following palindromes? |
|||
rotor => true |
|||
rosetta => false |
|||
step on no pets => true |
|||
été => true |
|||
wren => false |
|||
🦊😀🦊 => true |
|||
</pre> |
|||
=={{header|Wortel}}== |
=={{header|Wortel}}== |