using TinyPinyin;
namespace YieldChain.Helpers
{
///
/// 拼音帮助类
///
public class PingYinHelper
{
///
/// 汉字转拼音(注意:银行需要优化)
///
public static string GetPinYin(string strChinese)
{
if (string.IsNullOrWhiteSpace(strChinese))
{
return string.Empty;
}
//注意:银行需要优化
//注意:英文字母不会转大写
return PinyinHelper.GetPinyin(strChinese);
}
///
/// 汉字转拼音
///
public static string GetPinYin(string strChinese, string separator)
{
if (string.IsNullOrWhiteSpace(strChinese))
{
return string.Empty;
}
if (separator is null)
{
separator = string.Empty;
}
//注意:银行需要优化
//注意:英文字母不会转大写
return PinyinHelper.GetPinyin(strChinese, separator);
}
///
/// 汉字转拼音首字母
///
public static string GetFirstPinYin(string strChinese)
{
if (string.IsNullOrWhiteSpace(strChinese))
{
return string.Empty;
}
//注意:银行需要优化
//注意:英文字母不会转大写
return PinyinHelper.GetPinyinInitials(strChinese);
}
}
}