N1K003

Untitled

Apr 15th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1.         public Double Parse()
  2.         {
  3.             String html;
  4.             Double result;
  5.             Int32 first, last;
  6.             using (var client = new WebClient())
  7.             {
  8.                 html = client.DownloadString("https://www.coingecko.com/en/widget_component/ticker/ethereum/usd");
  9.             }
  10.             first = html.IndexOf("<span>$", StringComparison.Ordinal) + "<span>$".Length;
  11.             last = html.IndexOf("</span>", first, StringComparison.Ordinal);
  12.             Double.TryParse(html.Substring(first, last - first), NumberStyles.Any, new CultureInfo("en-US"), out result);
  13.             return result;
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment