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