Skip to content

Instantly share code, notes, and snippets.

@assadk88
Created August 1, 2019 15:01
Show Gist options
  • Save assadk88/9d6c519406af9a4b3a33297a356ac2c2 to your computer and use it in GitHub Desktop.
Save assadk88/9d6c519406af9a4b3a33297a356ac2c2 to your computer and use it in GitHub Desktop.
weirdcase
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