pub unsafe extern "C" fn rb_sprintf(fmt: *const c_char, ...) -> VALUEExpand description
Ruby’s extended sprintf(3). We ended up reinventing the entire printf
business because we don’t want to depend on locales. OS-provided printf
routines might or might not, which caused instabilities of the result
strings.
The format sequence is a mixture of format specifiers and other verbatim
contents. Each format specifier starts with a %, and has the following
structure:
%[flags][width][.precision][length]conversionThis function supports flags of , #, +, -, 0, width of
non-negative decimal integer and *, precision of non-negative decimal
integers and *, length of L, h, t, z, l, ll, q, conversions
of A, D, E, G, O, U, X, a, c, d, e, f, g, i,
n, o, p, s, u, x, and %. In case of _WIN32 it also supports
I. And additionally, it supports magical PRIsVALUE macro that can
stringise arbitrary Ruby objects:
[`rb_sprintf`]"|%"PRIsVALUE"|", RUBY_Qtrue); // => "|true|"
[`rb_sprintf`]"%+"PRIsVALUE, [`rb_stdin`]; // => "#<IO:<STDIN>>"@param[in] fmt A printf-like format specifier.
@param[in] … Variadic number of contents to format.
@return A rendered new instance of ::rb_cString.
@internal
§:FIXME: We can improve this document.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3