Parse a string to decimal with NumberStyles.AllowDecimalPoint
using System;
using System.Globalization;
class MainClass
{
public static void Main( )
{
decimal number;
string value = "1345,978";
NumberStyles style = NumberStyles.AllowDecimalPoint;
CultureInfo culture = CultureInfo.CreateSpecificCulture("fr-FR");
if (Decimal.TryParse(value, style, culture, out number))
Console.WriteLine("Converted '{0}' to {1}.", value, number);
else
Console.WriteLine("Unable to convert '{0}'.", value);
}
}
Related examples in the same category