Parser.cs 393 B

123456789101112131415161718
  1. using System;
  2. namespace CricketDuck_Standard_CLI
  3. {
  4. public class Parser
  5. {
  6. public static double parseDouble(string s)
  7. {
  8. if (!s.Contains ("."))
  9. return int.Parse (s);
  10. string part1 = s.Substring (0, s.IndexOf ('.'));
  11. string part2 = s.Substring (s.IndexOf ('.') + 1);
  12. double d = int.Parse (part1);
  13. d += int.Parse (part2) / Math.Pow (10, part2.Length);
  14. return d;
  15. }
  16. }
  17. }