reflexdemon
4/6/2018 - 12:21 AM

Test program to clear line

Test program to clear line

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");
  }
}