Mega Code Archive

 
Categories / Ruby / String
 

To change the last two letters

x = "This is a test" puts x.sub(/..$/, 'Hello')