static void Main(string[] args)
{
Console.WriteLine("请输入一个字符串:");
string str= Console.ReadLine();
Console.WriteLine("\n");
for (int i = 0; i )
{
string n= str.Substring(i, 1);
bool b =Number.GetNumber(n);
if (b ==true)
{
//Console.WriteLine(n+",");
Console.Write(n+",");
}
}
Console.ReadKey();
}
}
public class Number
{
public static bool GetNumber(string str)
{
bool b = false;
string[] arryList = { "0","1","2","3","4","5","6","7","8","9"};
foreach (string item in arryList)
{
if (item == str)
{
b = true;
break;
}
}
return b;
}
}