All String sequence can be replaced with other string literal the help of replaceAll() method in java. replaceAll() method returns a value in String. replaceAll method replace string character with all occurrences in string sequence. Use of String replaceAll() in java is shown below.
Example of String replaceAll() in java, JSP
public class StringReplaceAllExample { public static void main(String[] args) { String string = "Find String and replace All String"; String newString = string.replaceAll("String", "New"); System.out.println("Output :"+newString); } }
Output
Output :Find New and replace All New
Tags: String



Link to Us