/// <summary>
/// 将字符串转为字母
/// </summary>
/// <param name="name">字符串</param>
/// <returns>英文</returns>
public static string TranslateToEnglish(string name)
{
string strReg = @"^[A-Za-z0-9]+$";
if (Regex.IsMatch(name, strReg))
return name.ToUpper();
else
{
int index = name.IndexOf("(");
if (index > 0)
name = name.Substring(0, index);
name = ToolGood.Words.WordsHelper.GetFirstPinYin(name).ToUpper();
name = Regex.Replace(name, @"[^a-zA-Z0-9]+", "");
return name;
}
}
字符串转字母
最新推荐文章于 2022-05-10 12:53:43 发布