Capitalize the result with the capitalize method, if you want
line = "A horse! a horse! my kingdom for a horse!" line[18, 23].capitalize # => "My kingdom for a horse!"