mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
32c1b5f4d1
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@568 0fc631ac-6414-0410-93d0-97cfa31319b6
22 lines
680 B
Plaintext
22 lines
680 B
Plaintext
Function: format
|
|
|
|
--Usage--
|
|
> format(some_number, format: format_specification)
|
|
> format_rule(format: format_specification)(some_number)
|
|
|
|
Format a number or other string as a string, [[http://www.cplusplus.com/reference/clibrary/cstdio/printf.html|printf]] style.
|
|
This function is available in [[script:rule form]].
|
|
|
|
--Parameters--
|
|
| @input@ [[type:int]] or [[type:double]] or [[type:string]]
|
|
Item to format.
|
|
| @format@ [[type:string]] Format specification.
|
|
|
|
--Examples--
|
|
> format(format: "%03X", 13) == "00D"
|
|
> format(format: "%03d", 13) == "013"
|
|
> format(format: "%3s", "xy") == " xy"
|
|
>
|
|
> f := format_rule(format: "%03d")
|
|
> f(1) == "001"
|