Matcher quoteReplacement(String) method in Java with Examples
The quoteReplacement(String string) method of Matcher Class is used to get the replacement String literal of the String passed as parameter. This String literal acts as the parameter for the replace methods. Hence quoteReplacement() method acts as the intermediate in the replace methods.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public static String quoteReplacement(String string)
Parameters: This method takes a parameter string which is the String to be replaced in the Matcher.
Return Value: This method returns a String literal which is the replacement String for the matcher.
Below examples illustrate the Matcher.quoteReplacement() method:
GFG GGFGGGFGGGFGGGFGGFG GFG GFG GFG GFG
Reference: Oracle Doc