My issue is wanting to replace the content of a String with another String. For example, if I have the word Generating Code.., then after waiting two seconds, I want the program to replace Generating Code with Generating Code Successful.
* Note that I am using Eclipse, and the following code works for Notepad *
String code = "Generating code...\r";
String successful = code.replaceAll(code, "Generating the code has been successful.\r");
[...]
try {
System.out.print(code); // prints out Generating Code
Thread.sleep(2000); // Waits two seconds
System.out.print(successful); // Replaces Generating Code with has been successful
}
This code works in Notepad because the \r replaces the text. However, in Eclipse \r does not replace the text, and instead ends the line. Is there a way of getting this functionality to work in Eclipse?
My code in Eclipse is identical to that listed here that works in Notepad++.