Created
August 1, 2019 15:01
-
-
Save assadk88/9d6c519406af9a4b3a33297a356ac2c2 to your computer and use it in GitHub Desktop.
weirdcase
This file contains hidden or 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 weirdcase(string) | |
#TODO | |
array = string.split(" ") | |
if array.size > 0 | |
array.each { |word| | |
word.each_char{ |char| | |
if word.index(char).even? | |
word[index] = letter.upcase | |
end | |
} | |
} | |
return array.join(" ") | |
end | |
end | |
https://www.codewars.com/kata/weird-string-case/train/ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment