martes, 28 de abril de 2015

Clear terminal on ANSI way.

After searching for a way of clearing the terminal (or console, as you prefer), I found this post “Language Agnostic Clearing of Console Screen: Without clear() or cls()“. It’s a pretty good option, easy and without complicated tricks to do this.

On Java:

public class ansiclrscr {
    public static void main(String[] argv) {
        System.out.print("foo\nbar\nbaz\nquux");
        System.out.print("33[2J33[;H");
        System.out.print("I am at cursor position 0,0 on a clean screen");
    }
}

No hay comentarios:

Publicar un comentario