记录一下今天的收获:
1、下载文件的时候中文文件名为下划线的问题:
response.setHeader("Content-Disposition","attachment;"+ "filename="+ new String(filename.getBytes("UTF8"), "ISO8859-1") );
2、String replaceAll 的时候,如果正则表达式中有$等特殊符号,则失败的问题:
str.replaceAll( Matcher.quoteReplacement(",$,"),Matcher.quoteReplacement("$")) ;
java 文档中的说明是:
Returns a literal replacement String for the specified String. This method produces a String that will work as a literal replacement s in the appendReplacement method of the Matcher class. The String produced will match the sequence of characters in s treated as a literal sequence. Slashes (‘\’) and dollar signs (‘$’) will be given no special meaning.
了解 工作生活心情记忆 的更多信息
订阅后即可通过电子邮件收到最新文章。