namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Func func = new Func();
List
foreach (int iItem in lst)
{
Console.WriteLine(iItem);
}
}
}
//C#统计一个字符串的字母数字空格个数
class Func
{
public List
{
List
char[] chr = str.ToCharArray();
int iLetter = 0, iNum = 0, iSpace = 0;
foreach (char c in chr)
{
if (char.IsLetter(c))
{
iLetter++;
}
if (char.IsNumber(c))
{
iNum++;
}
if (char.IsWhiteSpace(c))
{
iSpace++;
}
}
lst.Add(iLetter);
lst.Add(iNum);
lst.Add(iSpace);
return lst;
}
}
}