Sha256: 1b76d404903773fec85921e382f8645ec20430939eb34645fab71e1b1b39b6ae
Contents?: true
Size: 314 Bytes
Versions: 1
Compression:
Stored size: 314 Bytes
Contents
def reverse(s:string) StringBuilder.new(s).reverse.toString() end def palindrome?(s:string) s.equals(reverse(s)) end puts palindrome?("anna") # ==> true puts palindrome?("Erik") # ==> false puts palindrome?("palindroom-moordnilap") # ==> true puts nil # ==> null
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.0.8-java | examples/rosettacode/palindrome.mirah |