Skip to content

@paul-ihnatolia /gist:1021760
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Перевірка строки на паліндром.rb
str = " ABCооооолльоCBA"
p str.gsub(/[^A-Z]/,"") == str.gsub(/[^A-Z]/,"").reverse
p str.scan(/[A-Z]/).join("") == str.scan(/[A-Z]/).join("").reverse
p str.split("").select{|x| x>="A" && x<="Z"}.join("") == str.split("").select{|x| x>="A" && x<="Z"}.join("").reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.