测试代码
void test() {
String str = "http://xxx.img.com?flower.jpg&t=1&c=3";
String result1 = Uri.encodeComponent(str);
String result2 = Uri.encodeFull(str);
print(str);
print(result1);
print(result2);
}
void main() {
test();
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
运行结果
http://xxx.img.com?flower.jpg&t=1&c=3
http%3A%2F%2Fxxx.img.com%3Fflower.jpg%26t%3D1%26c%3D3
http://xxx.img.com?flower.jpg&t=1&c=3
网友评论