Created
May 21, 2014 16:01
-
-
Save lolptdr/12fadbe4ece0c40bd83d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change a | |
smallcase = 'a'..'z' # smallcase.to_a.size #=> 26 | |
zeros = ("%026d" % 0).chars # creates array of 26 zeros | |
check = Hash[smallcase.zip(zeros)] #create hash map of alphabet to zeros | |
b = a.chars.each {|x| x.downcase!} | |
b.each do |x| | |
if check.include?(x) | |
check[x] = 1 | |
end | |
end | |
check.values.join() | |
end | |
change('a **& bZ') #=>'11000000000000000000000001' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment