C#如何拆分字符串中的数字和字母

string AAAAA= "ABCD1234";
//取出字符串中所有的英文字母
string strSplit1 = Regex.Replace(AAAAA, "[a-z]", "", RegexOptions.IgnoreCase);
//取出字符串中所有的数字
string strSplit2 = Regex.Replace(AAAAA, "[0-9]", "", RegexOptions.IgnoreCase);
获取的结果:strSplit1 =“1234“,strSplit2 =“ABCD”

posted @ 2020-05-26 17:27  奶茶先生  阅读(3054)  评论(0编辑  收藏  举报