如何在jsonparsing中的android中用URL中的%20替换空间 [英] how to replace space with %20 in url in android in jsonparsing
本文介绍了如何在jsonparsing中的android中用URL中的%20替换空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我想用字符串中的%20替换空格.我尝试过这种方式,
String flag1 ="http://74.208.194.142/admin/upload_image/1342594079_images(2).jpg";flag1.replaceAll(",%20");
但是它不起作用,请帮帮我.我收到了空指针异常.
解决方案
您应该这样做:
flag1 = flag1.replaceAll(",%20");
首先,您要放置空字符串而不是空格.其次,您必须将值返回到 flag1
变量中.
In my application i want to replace space with %20 in my string.I tried in this way,
String flag1="http://74.208.194.142/admin/upload_image/1342594079_images (2).jpg";
flag1.replaceAll("", "%20");
But it is not working please help me.I am getting null pointer exception.
解决方案
You should do it like:
flag1 = flag1.replaceAll(" ", "%20");
first you were putting empty string instead of space..
and second you must return the value into the flag1
variable..
这篇关于如何在jsonparsing中的android中用URL中的%20替换空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文