Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Kernel#sprintf

sprintf(format_string *objects) → string

Returns the string resulting from formatting objects into format_string.

For details on format_string, see Format Specifications.

Kernel#format is an alias for Kernel#sprintf.

See also #spawn #srand #sleep #String also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0