Is there exist the opposite to the newline '\n'
character in Java which will move back to the previous line in the console?
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With