C# Convert ToString(Char, IFormatProvider)
Description
Convert ToString(Char, IFormatProvider)
converts
the value of the specified Unicode character to its equivalent string representation,
using the specified culture-specific formatting information.
Syntax
Convert.ToString(Char, IFormatProvider)
has the following syntax.
public static string ToString(
char value,
IFormatProvider provider
)
Parameters
Convert.ToString(Char, IFormatProvider)
has the following parameters.
value
- The Unicode character to convert.provider
- An object that supplies culture-specific formatting information.
Returns
Convert.ToString(Char, IFormatProvider)
method returns The string representation of value.
Example
using System;/*from w w w . j ava 2 s .c om*/
using System.Globalization;
class MainClass
{
public static void Main( )
{
NumberFormatInfo provider = new NumberFormatInfo();
provider.NegativeSign = "neg ";
provider.PositiveSign = "pos ";
provider.NumberDecimalSeparator = ".";
provider.NumberGroupSeparator = ",";
provider.NumberGroupSizes = new int[ ] { 3 };
provider.NumberNegativePattern = 0;
Console.WriteLine( Convert.ToString( 12345 ));
Console.WriteLine( Convert.ToString( (char)12345, provider ) );
}
}
The code above generates the following result.