Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of formfeed and backspace escape strings in Java?

Tags:

java

escaping

Is there any practical usage for \r and \b in Java? Could someone give an example where it's used?

like image 654
GrowinMan Avatar asked Sep 11 '11 13:09

GrowinMan


1 Answers

Formfeed escape is \f, not \r. The former is useful for clearing the screen in a console, whilst the second is useful for progress displays (as stated by aioobe).

\b can be used in progress displays also, for example, on a ICMP Ping, you could display a dot when a ping is sent and a \b when it is received to indicate the amount of packet loss.

like image 172
squidge Avatar answered Oct 07 '22 01:10

squidge