c#提取首个字母为数字的字符串例如1001、2334,去掉A001之类

来源:百度知道 编辑:UC知道 时间:2024/06/07 06:58:00
就是有一系列的字符串 形如1001、2001、3322、A001、R443 但是我只要提取首个字符是否为数字 的字符串就可以 但是不知道用什么函数

string a = "A001";
try
{
int i= int.Parse(a.Substring(0, 1));
Response.Write("字串符a的首个字母是数字");
}
catch
{
Response.Write("字串符a的首个字母不是数字");
}

using System;
public class Test
{
static void Main()
{
string[] strList = new string[] { "1001","2000","adfdf","A2a43" };
foreach (string str in strList)
{
if (char.IsNumber(str, 0))
{
Console.WriteLine(str);
}
}
Console.ReadLine();
}
}

string[] strList = new string[] { "1001", "2000", "adfdf", "A2a43" };
char[] charList = null;
foreach(string str in strList)
{
charList = str.ToCharArray();
if (