digitalmars.D - [your code here]
- Hello (19/19) May 03 2019 string weather(float latitude, float longitude)
string weather(float latitude, float longitude) { import std.regex; import std.net.curl; import std.format; import std.conv; auto r = regex(q{<span class="summary swap">(.+)</span>}); foreach (line; byLine(format("https://darksky.net/forecast/%f,%f/ca24/en", latitude, longitude))) foreach (c; matchAll(line, r)) return c[1].to!string; return "bug"; } void main() { import std.stdio; weather(52.517, 13.3889).writeln; }
May 03 2019