Catlike Coding
Unity Code Documentation
Static Public Member Functions | Static Public Attributes | List of all members
CatlikeCoding.Utilities.StringBuilderUtility Class Reference

Utility class for efficient and fast StringBuilder manipulation. None of the methods create temporary or persistent objects. Memory allocation only happens when the StringBuilder needs more space. More...

Static Public Member Functions

static void AppendFloat (StringBuilder s, float number, int decimalCount)
 Append a float to a Stringbuilder. More...
 
static void AppendFloat (StringBuilder s, float number, int decimalCount, int digitCount)
 Append an integer to a StringBuilder and include left padding. More...
 
static void AppendFloatGrouped (StringBuilder s, float number, int decimalCount)
 Append a float to a Stringbuilder and include digit group separators. More...
 
static void AppendFloatGrouped (StringBuilder s, float number, int decimalCount, int digitCount)
 Append an integer to a StringBuilder and include both left padding and digit group separators. More...
 
static void AppendInt (StringBuilder s, int number)
 Append an int to a StringBuilder. More...
 
static void AppendInt (StringBuilder s, int number, int digitCount)
 Append an integer to a StringBuilder and include left padding. More...
 
static void AppendIntGrouped (StringBuilder s, int number)
 Append an integer to a StringBuilder and include digit group separators. More...
 
static void AppendIntGrouped (StringBuilder s, int number, int digitCount)
 Append an integer to a StringBuilder and include both left padding and digit group separators. More...
 
static void Reverse (StringBuilder s, int firstIndex, int lastIndex)
 Reverse a portion of a StringBuilder. More...
 

Static Public Attributes

static char decimalSeparator = '.'
 Character used as decimal separator. Change this if you don't want to use '.'. More...
 
static char groupSeparator = ','
 Character used as digit group separatator. Change this is you don't want to use ','. More...
 
static char padding = '0'
 Character used as padding. Change this is you don't want to use '0'. More...
 

Detailed Description

Utility class for efficient and fast StringBuilder manipulation. None of the methods create temporary or persistent objects. Memory allocation only happens when the StringBuilder needs more space.

Member Function Documentation

static void CatlikeCoding.Utilities.StringBuilderUtility.AppendFloat ( StringBuilder  s,
float  number,
int  decimalCount 
)
static

Append a float to a Stringbuilder.

Parameters
sA StringBuilder.
numberA float.
decimalCountHow many decimals to show.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendFloat ( StringBuilder  s,
float  number,
int  decimalCount,
int  digitCount 
)
static

Append an integer to a StringBuilder and include left padding.

Parameters
sA StringBuilder.
numberA float.
decimalCountHow many decimals to show.
digitCountHow many digits should be shown. If number's integer part has fewer digits, it will be padded to the left.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendFloatGrouped ( StringBuilder  s,
float  number,
int  decimalCount 
)
static

Append a float to a Stringbuilder and include digit group separators.

Parameters
sA StringBuilder.
numberA float.
decimalCountHow many decimals to show.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendFloatGrouped ( StringBuilder  s,
float  number,
int  decimalCount,
int  digitCount 
)
static

Append an integer to a StringBuilder and include both left padding and digit group separators.

Parameters
sA StringBuilder.
numberA float.
decimalCountHow many decimals to show.
digitCountHow many digits should be shown. If number's integer part has fewer digits, it will be padded to the left.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendInt ( StringBuilder  s,
int  number 
)
static

Append an int to a StringBuilder.

Parameters
sA StringBuilder.
numberThe int to append.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendInt ( StringBuilder  s,
int  number,
int  digitCount 
)
static

Append an integer to a StringBuilder and include left padding.

Parameters
sA StringBuilder.
numberAn int.
digitCountHow many digits should be shown. If number has fewer digits, it will be padded to the left.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendIntGrouped ( StringBuilder  s,
int  number 
)
static

Append an integer to a StringBuilder and include digit group separators.

Parameters
sA StringBuilder.
numberAn int.
static void CatlikeCoding.Utilities.StringBuilderUtility.AppendIntGrouped ( StringBuilder  s,
int  number,
int  digitCount 
)
static

Append an integer to a StringBuilder and include both left padding and digit group separators.

Parameters
sA StringBuilder.
numberAn int.
digitCountHow many digits should be shown. If number has fewer digits, it will be padded to the left.
static void CatlikeCoding.Utilities.StringBuilderUtility.Reverse ( StringBuilder  s,
int  firstIndex,
int  lastIndex 
)
static

Reverse a portion of a StringBuilder.

Parameters
sThe StringBuilder to modify.
firstIndexIndex of the first character to reverse.
lastIndexIndex of the last character to reverse.

Member Data Documentation

char CatlikeCoding.Utilities.StringBuilderUtility.decimalSeparator = '.'
static

Character used as decimal separator. Change this if you don't want to use '.'.

char CatlikeCoding.Utilities.StringBuilderUtility.groupSeparator = ','
static

Character used as digit group separatator. Change this is you don't want to use ','.

char CatlikeCoding.Utilities.StringBuilderUtility.padding = '0'
static

Character used as padding. Change this is you don't want to use '0'.