2018年06月08日

0
(0)

记录一下今天的收获:
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.

这篇文章有用吗?

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位评论此文章。

很抱歉,这篇文章对您没有用!

让我们改善这篇文章!

告诉我们我们如何改善这篇文章?

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据