string[] str={"asd","23","sd","45","v","5"};
List<int> list=new List<int>();
foreach(string item in str)
{
//1.
//int num;
// if(int.TryParse(item,out num))
//{
// list.add(num);
//}
//2.
if(Regex.IsMatch(item,@"\d+"))
{
list.add((int)item);
}
}
int[] arr=list.ToArray(); |