我如何在C#中所有可打印字符列表? [英] How do I get a list of all the printable characters in C#?
本文介绍了我如何在C#中所有可打印字符列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够获得在C#中所有可打印字符的字符数组,没有任何人知道如何做到这一点?
I'd like to be able to get a char array of all the printable characters in C#, does anybody know how to do this?
修改:
通过打印我的意思是明显的欧洲字符,所以是的,变音符号,波浪线,重音等
By printable I mean the visible European characters, so yes, umlauts, tildes, accents etc.
推荐答案
这会给你不被视为控制字符的所有字符的列表:
This will give you a list with all characters that are not considered control characters:
List<Char> printableChars = new List<char>();
for (int i = char.MinValue; i <= char.MaxValue; i++)
{
char c = Convert.ToChar(i);
if (!char.IsControl(c))
{
printableChars.Add(c);
}
}
您可能需要调查其他的Char.IsXxxx 方法,找到适合您需求的组合。
You may want to investigate the other Char.IsXxxx methods to find a combination that suits your requirements.
这篇关于我如何在C#中所有可打印字符列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文