Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Utils.FormattingHelper Class Reference

Provides common text formatting support for UI. More...

Inheritance diagram for Dragengine.Utils.FormattingHelper:

Public Member Functions

String formatCount (float count)
 Format count.
String formatCount (float count, int digits)
 Format count with custom digit count.
String formatPercentage (float percentage)
 Format percentage.
String formatPercentage (float percentage, int digits)
 Format percentage.
String formatSize (float size)
 Format size.
String formatSize (float size, int digits)
 Format size.
String formatTimeDifference (float seconds)
 Time difference.
FormattingHelper new ()
 Create FormattingHelper instance.

Detailed Description

Provides common text formatting support for UI.

Version
1.23

Member Function Documentation

◆ formatCount() [1/2]

String Dragengine.Utils.FormattingHelper.formatCount ( float count)

Format count.

Returns text in the form "1.2T", "1.2G", "1.2M", "1.2K" or just "12".

References formatCount().

Referenced by formatCount(), and formatCount().

◆ formatCount() [2/2]

String Dragengine.Utils.FormattingHelper.formatCount ( float count,
int digits )

Format count with custom digit count.

Same as formatCount(float) but with the choice of digits clamped to the range from 0 to 3.

References formatCount().

◆ formatPercentage() [1/2]

String Dragengine.Utils.FormattingHelper.formatPercentage ( float percentage)

Format percentage.

Returns text in the form "12.3%".

Referenced by formatTimeDifference().

◆ formatPercentage() [2/2]

String Dragengine.Utils.FormattingHelper.formatPercentage ( float percentage,
int digits )

Format percentage.

Same as #formatPercentags(float) but with the choice of digits clamped to the range from 0 to 3.

References formatSize().

◆ formatSize() [1/2]

String Dragengine.Utils.FormattingHelper.formatSize ( float size)

Format size.

Returns text in the form "1.2TB", "1.2GB", "1.2MB", "1.2Kk" or just "12b". Uses 1024 as divisor instead of 1000.

Referenced by formatPercentage(), and formatTimeDifference().

◆ formatSize() [2/2]

String Dragengine.Utils.FormattingHelper.formatSize ( float size,
int digits )

Format size.

Same as formatSize(float) but with the choice of digits clamped to the range from 0 to 3.

◆ formatTimeDifference()

String Dragengine.Utils.FormattingHelper.formatTimeDifference ( float seconds)

Time difference.

Returns text in the form "1d", "1h", "1min", "1s". For use with TimeDate#secondsSince(TimeDate) or remaining time calculations.

References formatPercentage(), formatSize(), and formatTimeDifference().

Referenced by formatTimeDifference().

◆ new()

FormattingHelper Dragengine.Utils.FormattingHelper.new ( )

Create FormattingHelper instance.

References new().

Referenced by new().


The documentation for this class was generated from the following file: