如何创建一个控制台应用程序来操作 system.out 中的文本? [英] How do I create a console application which manipulates text in system.out?

查看:33
本文介绍了如何创建一个控制台应用程序来操作 system.out 中的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,代替打印

/  
-  
\  
/  

在一个新行上让它保持在一行上并且是一个微调器的动画?

on a new line make it so it stays on one line and is an animation of a spinner?

推荐答案

是的,打印一个 \b(退格)以删除最后一个字符.简而言之:

Yes, print a \b (backspace) to remove the last character. In a nutshell:

System.out.print('/');
System.out.print('\b');
System.out.print('-');
System.out.print('\b');
System.out.print('\\');
System.out.print('\b');

请注意,这不是 由于错误而在 Eclipse 控制台中工作.但是,在命令控制台中,它应该可以正常工作.

Note that this doesn't work in Eclipse console due to a bug. In the command console, however, it should work fine.

这篇关于如何创建一个控制台应用程序来操作 system.out 中的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆