Last active
April 6, 2018 00:23
-
-
Save reflexdemon/771288bee72d8ad340ecb7072b6ffb29 to your computer and use it in GitHub Desktop.
Test program to clear line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClearLine { | |
public static void main(String[] argv) throws Exception { | |
//https://stackoverflow.com/questions/7522022/how-to-delete-stuff-printed-to-console-by-system-out-println?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | |
// int count = 1; | |
// System.out.print(String.format("\033[%dA",count)); // Move up | |
// System.out.print("\033[2K"); // Erase line content | |
System.out.print("hello"); | |
Thread.sleep(1000); // Just to give the user a chance to see "hello". | |
System.out.print("\b\b\b\b\b"); | |
System.out.print("world"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment