Java Matcher appendReplacement() methodThis method is used to implement append-and-replace step. First, It replaces compiled character or word with given input sequence and then it appends the given replacement string to the string buffer. SyntaxParameterstrbuff - The target string buffer replcmnt - The replacement string ReturnsThis matcher ThrowsIllegalStateException - If no match has yet been attempted, or if the previous match operation failed IllegalArgumentException - If the replacement string refers to a named-capturing group that does not exist in the pattern IndexOutOfBoundsException - If the replacement string refers to a capturing group that does not exist in the pattern Example 1Output: 'Let the cat 'Let the cat come out of the bag'.To disclose a secret(cat Example 2Output: 'Let the cat come out of the bag'.To disclose a secret(cat)** Example 3Output: Start : 0 End : 3 Start : 8 End : 11 Start : 15 End : 19 -Hello-word- Next TopicJava-matcher-appendtail-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India