java.util.regex.Pattern
JDK6的“边界匹配器”'\z' 和 '\Z'有什么区别?
背景:我试图将 UTF-8 编码文件的内容读入String
. 遇到了这个解决方案。我发现java.util.scanner.useDelimeter
使用java.util.regex.Pattern
. 前面提到的解决方案提出了'\Z'。
根据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