字串替換
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"
有關詳細資訊,請參閱 String %
docs 和 Kernel::sprintf 。
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"
有關詳細資訊,請參閱 String %
docs 和 Kernel::sprintf 。