-
Notifications
You must be signed in to change notification settings - Fork 3
/
example.d
33 lines (24 loc) · 1.08 KB
/
example.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import UaParser;
import std.stdio;
void main() {
auto agent = UaParser.parse("Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3");
std.stdio.writeln(agent.browser.family);
std.stdio.writeln(agent.browser.major);
std.stdio.writeln(agent.browser.minor);
std.stdio.writeln(agent.browser.patch);
std.stdio.writeln(agent.browser.toString);
std.stdio.writeln(agent.browser.toVersionString);
std.stdio.writeln("=================================");
std.stdio.writeln(agent.os.family);
std.stdio.writeln(agent.os.major);
std.stdio.writeln(agent.os.minor);
std.stdio.writeln(agent.os.patch);
std.stdio.writeln(agent.os.toString);
std.stdio.writeln(agent.os.toVersionString);
std.stdio.writeln("=================================");
std.stdio.writeln(agent.toFullString);
std.stdio.writeln("=================================");
std.stdio.writeln(agent.device.family);
std.stdio.writeln(agent.isMobile);
std.stdio.writeln(agent.isSpider);
}