Java Matcher quoteReplacement() 方法

2024年11月9日 | 阅读 1 分钟

Matcher 类的 quoteReplacement() 方法返回指定字符串的字面量替换字符串。此方法可与 matcher 对象一起使用,并在 matcher 类的 appendReplacement 方法中执行替换操作。

语法

参数

s - 要字面化的字符串

返回值

字面量字符串替换

自从 (Since)

1.5

示例 1

输出

java is platform :) 

示例 2

输出

Exception: Illegal group reference: group index is missing
java$ is secure .java$ is platform