Drag[en]gine Script Module DragonScript  1.23
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. More...
 
String formatCount (float count, int digits)
 Format count with custom digit count. More...
 
String formatPercentage (float percentage)
 Format percentage. More...
 
String formatPercentage (float percentage, int digits)
 Format percentage. More...
 
String formatSize (float size)
 Format size. More...
 
String formatSize (float size, int digits)
 Format size. More...
 
String formatTimeDifference (float seconds)
 Time difference. More...
 
FormattingHelper new ()
 Create FormattingHelper instance. More...
 

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".

◆ 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.

◆ formatPercentage() [1/2]

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

Format percentage.

Returns text in the form "12.3%".

◆ 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.

◆ 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.

◆ 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.

◆ new()

FormattingHelper Dragengine.Utils.FormattingHelper.new ( )

Create FormattingHelper instance.


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