Class NumberFormatters
This static class exposes methods to further simplify formatting of integers, floating point (single precision real numbers) and double precision real numbers. For integers, these methods cover both decimal and the most frequently used hexadecimal representations, spanning from two through sixteen hexadecimal glyphs.
Inheritance
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public static class NumberFormatters : object
Remarks
Since everything returns a string, the values can be appended to arrays of format items to use as inputs to the most open-ended overload of the string.Format method.
Methods
| Improve this Doc View SourceDecimalNumber(Double, Int32)
Format any double precision number per the Regional Settings, overriding the digits past the decimal point to render a specified number of significant digits to the right of the decimal point.
Declaration
public static string DecimalNumber(double pdblDecimalNumber, int pintSignificantDigits)
Parameters
Type | Name | Description |
---|---|---|
System.Double | pdblDecimalNumber | Floating point value to be formatted |
System.Int32 | pintSignificantDigits | Number of significant digits to display |
Returns
Type | Description |
---|---|
System.String | Floating point value, ready to display |
DecimalNumber(Single, Int32)
Format any floating point number per the Regional Settings, overriding the digits past the decimal point to render a specified number of significant digits to the right of the decimal point.
Declaration
public static string DecimalNumber(float pfltDecimalNumber, int pintSignificantDigits)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pfltDecimalNumber | Floating point value to be formatted |
System.Int32 | pintSignificantDigits | Number of significant digits to display |
Returns
Type | Description |
---|---|
System.String | Floating point value, ready to display |
DollarsAndCents(Double)
Format any double precision number per the Regional Settings, overriding the digits past the decimal point to render dollars and cents.
Declaration
public static string DollarsAndCents(double pdblDollarsAndCents)
Parameters
Type | Name | Description |
---|---|---|
System.Double | pdblDollarsAndCents | Floating point value to be formatted |
Returns
Type | Description |
---|---|
System.String | Floating point value, ready to display |
DollarsAndCents(Single)
Format any floating point number per the Regional Settings, overriding the digits past the decimal point to render dollars and cents.
Declaration
public static string DollarsAndCents(float pfltDollarsAndCents)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pfltDollarsAndCents | Floating point value to be formatted |
Returns
Type | Description |
---|---|
System.String | Floating point value, ready to display |
Hexadecimal16(Int64)
Format any long integer to display as a minimum of sixteen hexadecimal "digits."
Declaration
public static string Hexadecimal16(long plngAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | plngAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |
Hexadecimal2(Int32)
Format any integer to display as a minimum of two hexadecimal "digits."
Declaration
public static string Hexadecimal2(int pintAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pintAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |
Hexadecimal4(Int32)
Format any integer to display as a minimum of four hexadecimal "digits."
Declaration
public static string Hexadecimal4(int pintAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pintAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |
Hexadecimal8(Int32)
Format any integer to display as a minimum of eight hexadecimal "digits."
Declaration
public static string Hexadecimal8(int pintAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pintAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |
Integer(Int32)
Format any integer per the Regional Settings, overriding the digits past the decimal point to render an integer.
Declaration
public static string Integer(int pintAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pintAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |
Integer(Int64)
Format any long integer per the Regional Settings, overriding the digits past the decimal point to render an long integer.
Declaration
public static string Integer(long plngAnyInteger)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | plngAnyInteger | Integer to be formatted |
Returns
Type | Description |
---|---|
System.String | Formatted integer, ready to display |