Skip to content

Instantly share code, notes, and snippets.

@tearf001
Last active July 18, 2019 12:23
Show Gist options
  • Save tearf001/ca85d8a089f27428c77bbf49fb906fb5 to your computer and use it in GitHub Desktop.
Save tearf001/ca85d8a089f27428c77bbf49fb906fb5 to your computer and use it in GitHub Desktop.
uri-api
main() {
var p2 = '/Images/png/yw_icon.png';
var p3 = 'Images/png/yw_icon.png';
var rs = [
'http://61.183.0.23/gzzs/appstore.aspx?d=18',
'https://13.cn.123/root/',
'https://13.cn.123/api',
'ftp://123.23.132/',
'wx://123/23',
p2,
p3
];
for (var r in rs) {
print('--------$r-');
var uri = Uri.parse(r);
print('绝对 ${uri.isAbsolute},包含schema ${uri.hasScheme}| schema:${uri.scheme}');
print("""http: ${uri.isScheme('http')},
https: ${uri.isScheme('https')},
ftp: ${uri.isScheme('ftp')},
wx: ${uri.isScheme('wx')}""");
print(uri.resolve(p2));
print(uri.resolve(p3));
print(uri.resolve(r));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment