Hi All,
I'm fairly new to Java. I have a question involving the Replace Method. Is there, any way I can use the replace method to change a string that results in: Helle, Werld; to get it to result to Hello, World using the replace method. I have seen the Java CharSequence method but not sure if that is a part of the Replace method? Is there a way using the replace method for me to search for the sequence of "le" and replace it with "lo" and alos change "We" to "Wo"? I have to do this using the Replace Method and not sure? This an generic example for a test i'm running. Please see my code below:
public class Printer
{
public static void main(String[] args)
{
String test1 = "Holle, Werld!";
String test1Expected = "Hello, World!";
String newString1
newString1 = test1.replace('o', 'e');
System.out.println("newString1 = " + newString1);//it return back "Helle, Werld!" but I need to return back "Hello, World
}
}