str % arg â new_str
Instance Public methods
FormatâUses str as a format specification, and returns the result
of applying it to arg. If the format specification contains more
than one substitution, then arg must be an Array
or
Hash
containing the values to be substituted. See
Kernel::sprintf
for details of the format string.
"%05d" % 123 #=> "00123" "%-5s: %08x" % [ "ID", self.object_id ] #=> "ID : 200e14d6" "foo = %{foo}" % { :foo => 'bar' } #=> "foo = bar"
Please login to continue.