Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there "oldline" character in Java?

Is there exist the opposite to the newline '\n' character in Java which will move back to the previous line in the console?

like image 864
Yoda Avatar asked Dec 08 '22 19:12

Yoda


2 Answers

ASCII doesn't standardize a "line starve" or reverse line feed control character. Some character based terminals/terminal emulators recognize control code sequences that move the cursor up a line; these aren't Java-specific, and depend on your OS and configuration. Here's a starting point if you're using Linux: http://www.kernel.org/doc/man-pages/online/pages/man4/console_codes.4.html

like image 122
Russell Borogove Avatar answered Jan 05 '23 03:01

Russell Borogove


Java supports Unicode, which has the character "REVERSE LINE FEED" (U+008D). In Java it would be '\u008D' (as a char) or "\u008D" (as a String). Whether this would do what you want on a console, printout, or whatever, depends on the device. Java does not define any behavior for that character.

like image 33
Ted Hopp Avatar answered Jan 05 '23 03:01

Ted Hopp