Core Function SPrintf
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> SPrintf( <expression>, <expressions>... ) </pre> === Description === Create a formatted string. === expression === The format string and flags to use (see Remarks). ==...") |
|||
Line 14: | Line 14: | ||
Variables that will be output according to the "Format Control". | Variables that will be output according to the "Format Control". | ||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Return Value === | === Return Value === | ||
Line 28: | Line 23: | ||
=== Remarks === | === Remarks === | ||
− | + | Go see Printf() for details on the format string | |
+ | * [[Core Function Printf|Printf( <expression>, <expressions>... )]] -- Print a formatted string to the console window | ||
+ | |||
+ | Anything thats valid for Printf to print to console window is also valid for SPrintf to use to create strings. | ||
=== Example === | === Example === | ||
− | |||
− | |||
<syntaxhighlight lang="sputnik"> | <syntaxhighlight lang="sputnik"> | ||
+ | $val = SPrintf("Value is 0x'{0:x}'", (int)100) | ||
+ | Printf($val) ; Prints 0x64 since the {0:x} is telling it to place param 0 as :x meaning hex | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Revision as of 05:45, 10 November 2011
SPrintf( <expression>, <expressions>... )
Contents |
Description
Create a formatted string.
expression
The format string and flags to use (see Remarks).
expressions
Variables that will be output according to the "Format Control".
Return Value
Success: Returns the formatted string.
Failure: Returns an empty string.
Remarks
Go see Printf() for details on the format string
* Printf( <expression>, <expressions>... ) -- Print a formatted string to the console window
Anything thats valid for Printf to print to console window is also valid for SPrintf to use to create strings.
Example
$val = SPrintf("Value is 0x'{0:x}'", (int)100) Printf($val) ; Prints 0x64 since the {0:x} is telling it to place param 0 as :x meaning hex