ConvertHelper.cs 834 B

1234567891011121314151617181920212223242526
  1. using System.Globalization;
  2. namespace MuchInfo.Chart.Infrastructure.Helpers
  3. {
  4. public class ConvertHelper
  5. {
  6. public static float ParseSingle(string txt)
  7. {
  8. string text = txt.Replace(",", ".");
  9. return float.Parse(text, CultureInfo.InvariantCulture.NumberFormat);
  10. }
  11. public static double ParseDouble(string txt)
  12. {
  13. string text = txt.Replace(",", ".");
  14. return double.Parse(text, CultureInfo.InvariantCulture.NumberFormat);
  15. }
  16. public static string NumToString(float aNum)
  17. {
  18. return aNum.ToString(CultureInfo.InvariantCulture.NumberFormat);
  19. }
  20. public static string NumToString(double aNum)
  21. {
  22. return aNum.ToString(CultureInfo.InvariantCulture.NumberFormat);
  23. }
  24. }
  25. }