API Reference
NumberFormat
Compact, invariant formatting for numbers, percentages and durations used across widgets.
Inheritance
- Object
- NumberFormat
Methods
public static String Clock(TimeSpan elapsed, Boolean shortForm = false) #StringFormats a clock: 00:01:23 (or 01:23 under an hour when shortForm is true).
Parameters
- elapsed System.TimeSpan
- The elapsed time.
- shortForm System.Boolean = false
- Whether to drop the hours when zero.
Returns
The text.
public static String Compact(Double value) #StringFormats a count compactly: 950, 1.2k, 12k, 1.4M. NaN and infinities give "-".
Parameters
- value System.Double
- The value.
Returns
The text.
public static String Duration(TimeSpan duration) #StringFormats a duration compactly: 850ms, 12.4s, 1m 12s, 1h 02m.
Parameters
- duration System.TimeSpan
- The duration.
Returns
The text.
public static String Grouped(Double value) #StringFormats a number with thousands separators: 12,345. NaN and infinities give "-".
Parameters
- value System.Double
- The value.
Returns
The text.
public static Boolean IsFinite(Double value) #BooleanWhether a value is a real number (not NaN or an infinity).
Parameters
- value System.Double
- The value.
Returns
True when finite.
public static String Missing(GlyphTier tier) #StringThe text for a number that has no meaningful display (NaN, infinity): an em dash, or "-" in the ASCII tier.
Parameters
- tier ConsoleMonster.Capabilities.GlyphTier
- The glyph tier.
Returns
The dash.
public static String Percent(Double fraction) #StringFormats a fraction (0-1) as a whole percentage: 64%.
Parameters
- fraction System.Double
- The fraction.
Returns
The text.
public static Double PositiveOrZero(Double value) #DoubleThe value when it is finite and positive, otherwise 0 (for scales, totals and segment widths).
Parameters
- value System.Double
- The value.
Returns
The usable magnitude.
public static String Remaining(TimeSpan remaining) #StringA time left, rounded up: 12s under a minute, otherwise as NumberFormat.Duration (3m 05s).
Parameters
- remaining System.TimeSpan
- The time left.
Returns
The text.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?