fork(3) download
  1. using System;
  2. using System.Globalization;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("sv-SE");
  9. string[] values = new string[] { "1,000", "1,4500", "1" };
  10.  
  11. foreach (var value in values)
  12. {
  13. if (decimal.TryParse(value, out var eval))
  14. {
  15. bool isWholeNumber = Math.Floor(decimal.Parse(value)) == decimal.Parse(value);
  16. Console.WriteLine("The value " + value + " is integer " + isWholeNumber);
  17. }
  18. }
  19. }
  20. }
Success #stdin #stdout 0.02s 25036KB
stdin
Standard input is empty
stdout
The value 1,000 is integer True
The value 1,4500 is integer False
The value 1 is integer True