Hi if I have a string of text like the following:
string = "%hello %world ho%w is i%t goin%g"
"Hello World hoW is iT goinG
@thing = "%this is a %test this is %only a %test"
indicator_position = @thing.index("%")
lowercase_letter_position = indicator_position + 1
lowercase_letter = @thing[lowercase_letter_position]
"This is a Test this is %only a Test"
You can do this with
gsub and a block:
string.gsub(/\%(.)/) do |m| m.upcase end
Using a block allows you to run arbitrary code on each match.