To string: Difference between revisions
Jump to navigation
Jump to search
imported>C22 No edit summary |
imported>C22 No edit summary |
||
Line 26: | Line 26: | ||
}}| | }}| | ||
function_description=Returns any datatype as its string equivalent. For int and float types, you may optionally specify a format string, which can be useful for printing only a few decimal places, or placing commas to break up large numerals.| | function_description=Returns any datatype as its string equivalent. For int and float types, you may optionally specify a format string, which can be useful for (among other things) printing only a few decimal places, or placing commas to break up large numerals.| | ||
needscode=yes| | needscode=yes| |
Revision as of 04:34, 20 December 2012
needs(code_samples);
Function Syntax
string to_string( any anything)
- anything is any data type that KoLmafia uses
string to_string( num number, string format)
- number is either an int or a float
- format is a format string used by the Java formatter
Returns any datatype as its string equivalent. For int and float types, you may optionally specify a format string, which can be useful for (among other things) printing only a few decimal places, or placing commas to break up large numerals.
Special
Note that this function isn't needed for print() and string concatenation, as KoLmafia handles conversions transparently in those cases; however, this function is still useful for passing a non-string value as a string parameter, or a part thereof.