-2

java.util.regex.PatternJDK6的“边界匹配器”'\z' 和 '\Z'有什么区别?

背景:我试图将 UTF-8 编码文件的内容读入String. 遇到了这个解决方案。我发现java.util.scanner.useDelimeter使用java.util.regex.Pattern. 前面提到的解决方案提出了'\Z'。

4

1 回答 1

1

根据http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html,区别在于:

\Z  The end of the input but for the final terminator, if any
\z  The end of the input
于 2013-10-14T08:54:58.607 回答