Class: Toybox.Lang.Number
 Inherits:

Toybox.Lang.Object
Overview
Number represents a 32bit signed integer.
Instance Method Summary collapse

abs() as Number
Get the absolute value of a Number.

format(format as String) as String
Format a Number using a formatting String.

toChar() as Char
Convert a Number to a Char.

toDouble() as Double
Convert a Number to a Double.

toFloat() as Float
Convert a Number to a Float.

toLong() as Long
Convert a Number to a Long.

toNumber() as Number
Convert a Number to a Number.
Instance Method Details
abs() as Number
Get the absolute value of a Number.
format(format as String) as String
Format a Number using a formatting String.
The formatting string is similar to that available in printf
from the
C stdio library, though the length
option is not available:
"%[flags][width][.precision]specifier"
 specifiers


d or i  signed decimal integer

e  scientific notation (mantissa/exponent) using 'e' character

E  scientific notation (mantissa/exponent) using 'E' character

f  decimal floating point

o  signed octal

u  unsigned decimal integer

x  unsigned hexadecimal integer

X  unsigned hexadecimal integer (capital letters)

 flags


+  Prepends the result with a plus or minus sign ('+' or ''), including positive numbers. By default, only negative numbers are preceded with a '' sign.

0  Leftpads the number with zeros (0) instead of spaces, where padding is specified (see width subspecifier).

 width

supports only numbers (* is not supported)
 .precision

supports only numbers (* is not supported)
toChar() as Char
Convert a Number to a Char.
toDouble() as Double
Convert a Number to a Double.
toFloat() as Float
Convert a Number to a Float.
toLong() as Long
Convert a Number to a Long.
toNumber() as Number
Convert a Number to a Number.