C#提取字符串中的英文

        /// <summary>
        /// 提取英文
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string GetSubString(string str)
        {
            Regex regex = new Regex("^[A-Za-z]+");

            MatchCollection mMactchCol = regex.Matches(str);
            string strA_Z = string.Empty;
            foreach (Match mMatch in mMactchCol)
            {
                strA_Z += mMatch.Value;
            }
            return strA_Z;
        }

 

posted @ 2020-07-09 20:36  be--yourself  阅读(1047)  评论(0编辑  收藏  举报