ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы.



sprintf

sprintf format, list

Returns a string formatted by the printf conventions. The format string contains text with embedded field specifiers into which the elements of list are substituted, one per field. Field specifiers are roughly of the form:

%m.nx
where the m and n are optional sizes whose interpretation depends on the type of field, and x is one of the following:

CodeMeaning
%Percent sign
cCharacter
dDecimal integer
eExponential format floating-point number
EExponential format floating-point number with uppercase E
fFixed-point format floating-point number
gFloating-point number, in either exponential or fixed decimal notation
GLike g with uppercase E (if applicable)
ldLong decimal integer
loLong octal integer
luLong unsigned decimal integer
lxLong hexadecimal integer
oOctal integer
sString
uUnsigned decimal integer
xHexadecimal integer
XHexadecimal integer with uppercase letters
pThe Perl value's address in hexadecimal
n

Special value that stores the number of characters output so far into the next variable in the parameter list.

m is typically the minimum length of the field (negative for left-justified), and n is precision for exponential formats and the maximum length for other formats. Padding is typically done with spaces for strings and zeroes for numbers. The * character as a length specifier is not supported.