Illegal unquoted character ((CTRL-CHAR, code X)): has to be escaped using backslash to be included in string value


報錯

Illegal unquoted character ((CTRL-CHAR, code 9)): has to be escaped using backslash to be included in string value

查看是哪個字符導致的

System.out.println(new String( Character.toChars(9) ));

糾錯

把這個字符替換掉即可。

str = str.replace( new String( Character.toChars(x) ),"");

我的code 9是制表符\t導致的問題,.replaceAll("\t", " ")或.replace( new String( Character.toChars(9) ),"")替換掉即可,同理其他的\r、\n替換掉即可。

參考:
https://www.cnblogs.com/glory-jzx/p/10752493.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM