Table of Contents

Class FloatToTextExtensions

Namespace
Switchboard
Assembly
Switchboard.TextConverter.dll

Adds extension methods to float and double for converting to strings of characters.

public static class FloatToTextExtensions
Inheritance
FloatToTextExtensions

Methods

ConvertToText(double, Span<char>)

Converts a double-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this double value, Span<char> result)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(double, Span<char>, FloatFormatInfo)

Converts a double-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this double value, Span<char> result, FloatFormatInfo format)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

format FloatFormatInfo

Detailed settings for formatting the result.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(double, Span<char>, FloatFormatInfo, out bool)

Converts a double-precision floating-point number into a Span<T> of characters, without a negative sign.

public static int ConvertToText(this double value, Span<char> result, FloatFormatInfo format, out bool valueIsNegative)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

format FloatFormatInfo

Detailed settings for formatting the result.

valueIsNegative bool

The value will be true if the value is a negative number.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(double, Span<char>, int)

Converts a double-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this double value, Span<char> result, int minFractionalDigits)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits is less than zero.

ConvertToText(double, Span<char>, int, int)

Converts a double-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this double value, Span<char> result, int minFractionalDigits, int maxFractionalDigits)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText(double, Span<char>, int, int, bool)

Converts a double-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this double value, Span<char> result, int minFractionalDigits, int maxFractionalDigits, bool groupDigits)

Parameters

value double

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

groupDigits bool

Whether to separate digit groups with a comma.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText(float, Span<char>)

Converts a single-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this float value, Span<char> result)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(float, Span<char>, FloatFormatInfo)

Converts a single-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this float value, Span<char> result, FloatFormatInfo format)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

format FloatFormatInfo

Detailed settings for formatting the result.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(float, Span<char>, FloatFormatInfo, out bool)

Converts a single-precision floating-point number into a Span<T> of characters, without a negative sign.

public static int ConvertToText(this float value, Span<char> result, FloatFormatInfo format, out bool valueIsNegative)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

format FloatFormatInfo

Detailed settings for formatting the result.

valueIsNegative bool

The value will be true if the value is a negative number.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ConvertToText(float, Span<char>, int)

Converts a single-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this float value, Span<char> result, int minFractionalDigits)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits is less than zero.

ConvertToText(float, Span<char>, int, int)

Converts a single-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this float value, Span<char> result, int minFractionalDigits, int maxFractionalDigits)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText(float, Span<char>, int, int, bool)

Converts a single-precision floating-point number into a Span<T> of characters.

public static int ConvertToText(this float value, Span<char> result, int minFractionalDigits, int maxFractionalDigits, bool groupDigits)

Parameters

value float

The number to convert.

result Span<char>

The target to contain the result of the conversion.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

groupDigits bool

Whether to separate digit groups with a comma.

Returns

int

Returns the number of characters in the result.

Exceptions

IndexOutOfRangeException

Thrown if result is not long enough to hold the value.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText<T>(double, T, ReadOnlySpanAction<char, T>)

Converts a double-precision floating-point number into a Span<T> of characters.

public static void ConvertToText<T>(this double value, T argument, ReadOnlySpanAction<char, T> action)

Parameters

value double

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ConvertToText<T>(double, T, ReadOnlySpanAction<char, T>, FloatFormatInfo)

Converts a double-precision floating-point number into a Span<T> of characters.

public static void ConvertToText<T>(this double value, T argument, ReadOnlySpanAction<char, T> action, FloatFormatInfo format)

Parameters

value double

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

format FloatFormatInfo

Detailed settings for formatting the result.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ConvertToText<T>(double, T, ReadOnlySpanAction<char, T>, int)

Converts a double-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this double value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits)

Parameters

value double

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits is less than zero.

ConvertToText<T>(double, T, ReadOnlySpanAction<char, T>, int, int)

Converts a double-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this double value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits, int maxFractionalDigits)

Parameters

value double

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText<T>(double, T, ReadOnlySpanAction<char, T>, int, int, bool)

Converts a double-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this double value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits, int maxFractionalDigits, bool groupDigits)

Parameters

value double

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

groupDigits bool

Whether to separate digit groups with a comma.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText<T>(float, T, ReadOnlySpanAction<char, T>)

Converts a single-precision floating-point number into a Span<T> of characters.

public static void ConvertToText<T>(this float value, T argument, ReadOnlySpanAction<char, T> action)

Parameters

value float

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ConvertToText<T>(float, T, ReadOnlySpanAction<char, T>, FloatFormatInfo)

Converts a single-precision floating-point number into a Span<T> of characters.

public static void ConvertToText<T>(this float value, T argument, ReadOnlySpanAction<char, T> action, FloatFormatInfo format)

Parameters

value float

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

format FloatFormatInfo

Detailed settings for formatting the result.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ConvertToText<T>(float, T, ReadOnlySpanAction<char, T>, int)

Converts a single-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this float value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits)

Parameters

value float

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits is less than zero.

ConvertToText<T>(float, T, ReadOnlySpanAction<char, T>, int, int)

Converts a single-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this float value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits, int maxFractionalDigits)

Parameters

value float

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

ConvertToText<T>(float, T, ReadOnlySpanAction<char, T>, int, int, bool)

Converts a single-precision floating-point number into a Span<T> of characters, then passes the ReadOnlySpan<T> to the provided action, along with the argument.

public static void ConvertToText<T>(this float value, T argument, ReadOnlySpanAction<char, T> action, int minFractionalDigits, int maxFractionalDigits, bool groupDigits)

Parameters

value float

The number to convert.

argument T

The argument to pass into the action.

action ReadOnlySpanAction<char, T>

The action to perform with the resulting ReadOnlySpan<T> of characters.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

groupDigits bool

Whether to separate digit groups with a comma.

Type Parameters

T

The type of argument to pass into the action.

Exceptions

ArgumentNullException

Thrown if action is null.

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.