Mega Code Archive

 
Categories / Ruby / String
 

Enter a range to indicate a range of characters you want to change Include the last character with two dots ( )

speaker = "This is a test. This is a test. This is a test. This is a test. This is a test. " speaker[13..15]= "This is a test. " # => "the Third" p speaker # => "King Richard the Third"