vectra 发表于 2008-3-23 17:23:00

LISP的类C语言Format函数, strcat的替代方案

<p>R2004~2006适用,无限制,加载无提示信息,可自由使用</p><p>通过 LISP 加载</p><p>(arxload "mtutil16.arx")</p><p>调用</p><p>Formats string similar to the <!--Element not supported - Type: 8 Name: #comment-->sprintf<!--Element not supported - Type: 8 Name: #comment-->
                <!--Element not supported - Type: 8 Name: #comment-->C-Runtime<!--Element not supported - Type: 8 Name: #comment--> library function.</p><!--Element not supported - Type: 8 Name: #comment--><hr/><h4>Syntax </h4><p class="Code">(vl_strformat&nbsp; format arg1 arg2 ...) </p><h4>Parameters </h4><p class="Code">format</p><p>A string that contains the text to be formatted. It can optionally contain embedded format tags that are substituted by the values specified in subsequent <!--Element not supported - Type: 8 Name: #comment-->argument(s<!--Element not supported - Type: 8 Name: #comment-->) and formatted as requested. The number of arguments following the format parameters should at least be as much as the number of format tags. </p><p>&nbsp;</p><p>The format tags follow this prototype:</p><p>&nbsp;</p><p class="Code">%[.precision]specifier
        </p><p style="FONT-WEIGHT: bold;">&nbsp;</p><p>Where specifier is the most significant one and defines the type and the interpretation of the value of the corresponding argument:</p><p>&nbsp;</p><p><!--Element not supported - Type: 8 Name: #comment--><table cellspacing="0" width="100%" x-use-null-cells="" style="WIDTH: 100%; x-cell-content-align: top; border-spacing: 0;"><colgroup><col style="WIDTH: 10.85%;"></col><col style="WIDTH: 76.44%;"></col><col style="WIDTH: 12.84%;"></col></colgroup><tbody><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p align="center" style="FONT-WEIGHT: bold; TEXT-ALIGN: center;">Specifier</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p align="center" style="FONT-WEIGHT: bold; TEXT-ALIGN: center;">Output</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p align="center" style="FONT-WEIGHT: bold; TEXT-ALIGN: center;">Example</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->c<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Character</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>a</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->d<!--Element not supported - Type: 8 Name: #comment--> or i</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Signed decimal integer</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>392</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->e<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Scientific notation (/exponent) using <!--Element not supported - Type: 8 Name: #comment-->e<!--Element not supported - Type: 8 Name: #comment--> character</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>3.9265e+2</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->E<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Scientific notation (exponent) using <!--Element not supported - Type: 8 Name: #comment-->E<!--Element not supported - Type: 8 Name: #comment--> character</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>3.9265E+2</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->f<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Decimal floating point</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>392.65</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->g<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Use the shorter of %<!--Element not supported - Type: 8 Name: #comment-->e<!--Element not supported - Type: 8 Name: #comment--> or %<!--Element not supported - Type: 8 Name: #comment-->f<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>392.65</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->G<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Use the shorter of %<!--Element not supported - Type: 8 Name: #comment-->E<!--Element not supported - Type: 8 Name: #comment--> or %<!--Element not supported - Type: 8 Name: #comment-->f<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>392.65</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->o<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Signed octal</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>610</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>s</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>String of characters</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>sample</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>u</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Unsigned decimal integer</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>7235</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>x</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Unsigned hexadecimal integer</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>7fa</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>X</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Unsigned hexadecimal integer (capital letters)</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>7FA</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p><!--Element not supported - Type: 8 Name: #comment-->n<!--Element not supported - Type: 8 Name: #comment--></p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Nothing printed. The argument must be a pointer to a signed integer, where the number of characters written so far is stored.</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>&nbsp;</p></td></tr><tr valign="top"><td width="10.85%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>%</p></td><td width="76.44%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>A % followed by another % character will write % to the string.</p></td><td width="12.84%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>&nbsp;</p></td></tr></tbody></table></p><p>&nbsp;</p><p>The tag can also contain flags, width, .precision and modifiers sub-specifiers, which are optional and follow these specifications: </p><p>&nbsp;</p><p><!--Element not supported - Type: 8 Name: #comment--><table cellspacing="0" width="100%" x-use-null-cells="" style="WIDTH: 100%; x-cell-content-align: top; border-spacing: 0;"><colgroup><col style="WIDTH: 10.66%;"></col><col style="WIDTH: 89.33%;"></col></colgroup><tbody><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Flag</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Description</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>-</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Left-justify within the given field width; Right justification is the default (see width sub-specifier).</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>+</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Forces to proceed the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>(space)</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>If no sign is going to be written, a blank space is inserted before the value.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>#</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Used with <!--Element not supported - Type: 8 Name: #comment-->o<!--Element not supported - Type: 8 Name: #comment-->, x or X specifiers the value is proceeded with 0, 0x or 0X respectively for values different than zero.</p><p>Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow. By default, if no digits follow, no decimal point is written.</p><p>Used with g or G the result is the same as with e or E but trailing zeros are not removed.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>0</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier).</p></td></tr></tbody></table></p><p>&nbsp;</p><p>&nbsp;</p><p><!--Element not supported - Type: 8 Name: #comment--><table cellspacing="0" width="100%" x-use-null-cells="" style="WIDTH: 100%; x-cell-content-align: top; border-spacing: 0;"><colgroup><col style="WIDTH: 10.66%;"></col><col style="WIDTH: 89.33%;"></col></colgroup><tbody><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Width</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Description</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>number</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>*</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>The width is not specified in the format string, but as an additional integer value argument proceeded the argument that has to be formatted.</p></td></tr></tbody></table></p><p>&nbsp;</p><p>&nbsp;</p><p><!--Element not supported - Type: 8 Name: #comment--><table cellspacing="0" width="100%" x-use-null-cells="" style="WIDTH: 100%; x-cell-content-align: top; border-spacing: 0;"><colgroup><col style="WIDTH: 10.66%;"></col><col style="WIDTH: 89.33%;"></col></colgroup><tbody><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Precision</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Description</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>number</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.</p><p>For e, E and f specifiers: this is the number of digits to be printed after de decimal point.</p><p>For g and G specifiers: This is the maximum number of significant digits to be printed.</p><p>For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.</p><p>For c type: it has no effect.</p><p>When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>*</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted.</p></td></tr></tbody></table></p><p>&nbsp;</p><p>&nbsp;</p><p><!--Element not supported - Type: 8 Name: #comment--><table cellspacing="0" width="100%" x-use-null-cells="" style="WIDTH: 100%; x-cell-content-align: top; border-spacing: 0;"><colgroup><col style="WIDTH: 10.66%;"></col><col style="WIDTH: 89.33%;"></col></colgroup><tbody><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Length</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p style="FONT-WEIGHT: bold;">Description</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>h</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>The argument is interpreted as a short integer or unsigned short integer (only applies to integer specifiers: i, d, o, u, x and X).</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>l</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>The argument is interpreted as a long int or unsigned long int for integer specifiers (i, d, o, u, x and X), and as a wide character or wide character string for specifiers c and s.</p></td></tr><tr valign="top"><td width="10.66%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>L</p></td><td width="89.33%" style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BORDER-RIGHT-STYLE: none; BORDER-BOTTOM-STYLE: none;"><p>The argument is interpreted as a long double (only applies to floating point specifiers: e, E, f, g and G). </p></td></tr></tbody></table></p><p>&nbsp;</p><p class="Code">substring
        </p><p>Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value. </p><h4>Returns </h4><p>The formatted string if successful. </p><p>nil on error. </p>
页: [1]
查看完整版本: LISP的类C语言Format函数, strcat的替代方案