英文:
Convert to bold,italic,strikethrought text in java
问题
如何将文本转换为粗体、斜体 和< s >删除线< /s >?我看过一些将文本放置在窗口中的教程,但那不是我想要的。我希望完全基于控制台,没有窗口或类似的东西。
示例:
bold("ue") => 𝈂𝈊
italic("la") => 𝈵𝈲
strike("qw") => q̶w̶
非常感谢!非常感谢您的帮助!
英文:
how can I convert text to bold, italic & <s>strikethrough</s>? I've seen some tutorials which set the text in the window but that's not what I want. I want to base entirely on the console, no windows or anything like that.
Sample:
bold("ue") => 𝘂𝗲
italic("la") => 𝘭𝘢
strike("qw") => q̶w̶
>Thanks a lot! Your help is very much appreciated!!!
答案1
得分: 1
你可以使用ANSI转义序列来为控制台文本(文本样式、颜色)设置样式。然而,并非每个控制台都支持此功能。在下面的问题中,得票数最高的答案详细介绍了如何实现这一点:
https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
英文:
You can style console text (text styles, colors) using ANSI Escape Sequences. Not every console may support it though. The top-voted answer in the following question provides an excellent overview on how to achieve this:
https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
专注分享java语言的经验与见解,让所有开发者获益!
评论