how to insert in place of space in android

后端 未结 7 987
死守一世寂寞
死守一世寂寞 2020-12-08 19:31

I have a xml URL file in which there are white spaces i want to replace white spaces with %20.. how to do this????

SAXParserFactory spf = SAXParserFactory.ne         


        
相关标签:
7条回答
  • Just one addition to sudocode's response:

    Use android.net.Uri.encode instead of URLEncoder.encode to avoid the "spaces getting converted into +" problem. Then you get rid of the String.replaceAll() and it's more elegant :)

    StringBuilder query = new StringBuilder();
    query.append("gallery=");
    query.append(android.net.Uri.encode(value));
    
    0 讨论(0)
提交回复
热议问题