[英]Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 72
When I am reading numbers from contact book, then i replace the contact number by using the below code 当我从通讯录中读取电话号码时,请使用以下代码替换该电话号码
String number ="+91 97-00-0000000";
String numberValue =number.replaceAll(" ", "%20");
And i am getting the following exception 我收到以下异常
Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 72:
I have already encoded this number ie numberValue = URLEncoder.encode(number, "UTF-8");
我已经编码了这个数字,即
numberValue = URLEncoder.encode(number, "UTF-8");
it crashes with the same exception. 它以相同的异常崩溃。
// try this way,hope this will help you...
String number ="+91 97-00-0000000";
String numberValue =number.replaceAll("(?<=\\d) +(?=\\d)", "%20");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.