分别获取一个字符串中的字母和数字

 string    str20   =   "ABC123";   
 string   strSplit1=string.Empty;
 string   strSplit2=string.Empty;   
    
  //取出字符串中所有的数字   
  strSplit1   =   Regex.Replace(str20,"[a-z]","",RegexOptions.IgnoreCase);   


  //取出字符串中所有的英文字母   
  strSplit2   =   Regex.Replace(str20,"[0-9]","",RegexOptions.IgnoreCase);  

 这个方法挺实用的,解决了很多动态生成序列号一系列问题;

原文地址:https://www.cnblogs.com/BraveBoy/p/7412773.html