Works with the strange edge case. Also sorry typed on tablet.
str="Weird ,string case."class<<strdefto_weird_caseString.new.tapdo|s|i=0whilei<self.length# work out with edge caseifself[i]=~/[^a-zA-Z]/s<<self[i]i+=1nextend# we add to_s because we may be out of bounds;# that way we get the empty string instead of nil# and an exceptions<<self[i].to_s.upcases<<self[i+1].to_s.downcasei+=2endendendendstr.to_weird_case
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.
Ruby solution. Doesn’t use modulo.
Works with the strange edge case. Also sorry typed on tablet.