Substituting Variables Into an Existing String : String format « String « Ruby






Substituting Variables Into an Existing String


template = 'O with %s.'
puts template % 'E'

 








Related examples in the same category

1.use % for format printing
2.Replace string with float
3.Changing the Case of a String
4.Center, left justify and right justify string