如何使用格式化代码格式化字符串以使Windows cmd具有格式化字符串?基于控制台格式化代码的格式字符串
所以基本上我有一个像~b~Hello World~r~
这样的字符串。
当我输出到cmd时,它应该显示为<blue from here on>Hello World<reset to normal>
。
至于我knwo,CMD有一定的Unicode字符更改下列文本格式,但我不记得他们(像\u00234
)
因此,我想到的是:
public string FormatString(string input)
{
input = Regex.Replace(input, "~b~", "<unicode for blue>", RegexOptions.IgnoreCase);
input = Regex.Replace(input, "~r~", "<Unicode for reset>", RegexOptions.IgnoreCase);
return input;
}
是设置“Console.BackgroundColor”还是“Console.ForegroundColor”,然后调用Console.ResetColor(),如[this](http://stackoverflow.com/questions/6859483/)如何对变化的前景和背景,字体颜色,在控制台)? –
请不要在Stack Overflow上使用txtspk。例如,“some1”不是英语中的单词。另外,当提到你自己时,I是大写的。 –
我们是在堆栈溢出还是语法溢出? – Bluscream