Convert to bold, italic, strikethrough text in Java

huangapple go评论77阅读模式
英文:

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(&quot;ue&quot;) =&gt; &#120322;&#120306;
italic(&quot;la&quot;) =&gt; &#120365;&#120354;
strike(&quot;qw&quot;) =&gt; 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

huangapple
  • 本文由 发表于 2020年5月4日 22:57:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/61595223.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定