Ruby Language Substitution de cordes


Exemple

p "This is %s" % "foo"
# => "This is foo"

p "%s %s %s" % ["foo", "bar", "baz"]
# => "foo bar baz"

p "%{foo} == %{foo}" % {:foo => "foo" }
# => "foo == foo"

Voir String % docs et Kernel :: sprintf pour plus de détails.