First try in Ruby, I think this can be done without splitting and rejoining.
defcapitalizeFirstLast(string)string.split(' ').eachdo|word|word.downcase!word.sub!(/\A./){|match|match.upcase}# First Charword.sub!(/.\z/){|match|match.upcase}# Last Charend.join(' ')endputscapitalizeFirstLast"tHIs is my string"# => ThiS IS MY StrinG
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
First try in Ruby, I think this can be done without splitting and rejoining.