当我从联系簿中读取号码时,我会使用以下代码替换联系号码
String number ="+91 97-00-0000000";
String numberValue =number.replaceAll(" ", "%20");
我得到以下异常
Caused by: java.lang.IllegalArgumentException: Illegal character in query at index 72:
我已经编码了这个数字,即numberValue = URLEncoder.encode(number, "UTF-8");
它以相同的异常崩溃。
答案 0 :(得分:0)
// try this way,hope this will help you...
String number ="+91 97-00-0000000";
String numberValue =number.replaceAll("(?<=\\d) +(?=\\d)", "%20");