Interface Formattable
Provides the format
function, which allows objects to be formatted according to a format string.
The format string's meaning is defined by the object being formatted.
Format strings may be provided to formattable objects during string interpolation, using the syntax
"\{value:format}"
. For instance,
def value := 255
Console.printLine("\{value} in hexadecimal is: \{value:X}")
This calls value.format("X")
, which is understood by the Int64
class to mean "format this number
in uppercase hexadecimal". This results in the output:
255 in hexadecimal is: FF
and is equivalent to having written:
Console.printLine(value + " in hexadecimal is: " + value.format("X"))
- Source Code:
- View Source
Inherited Fields: