Converts float to string using the specified culture-specific format information.
using System;
using System.Globalization;
public class Example
{
public static void Main()
{
float value;
value = -16325.62015F;
Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));
Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("en-GB")));
Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("de-DE")));
value = 1234567.123E21F;
Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));
Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("en-GB")));
Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("de-DE")));
}
}
/*
-16325.62
-16325.62
-16325,62
1.234567E+27
1.234567E+27
1,234567E+27
*/
Related examples in the same category