Ruby Language Formatted strings


Example

Ruby can inject an array of values into a string by replacing any placeholders with the values from the supplied array.

"Hello %s, my name is %s!" % ['World', 'br3nt']
# => Hello World, my name is br3nt!

The place holders are represented by two %s and the values are supplied by the array ['Hello', 'br3nt']. The % operator instructs the string to inject the values of the array.