Skip to content

Commit

Permalink
[fix] 修正PinYin.GetFirst在某些字取不到拼音时报错的bug。该bug导致XCode.Area无法加载,有个镇的名字其中…
Browse files Browse the repository at this point in the history
…一个字无法转拼音
  • Loading branch information
nnhy committed Feb 1, 2024
1 parent 4d8a17e commit 0f6ecc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion NewLife.Core/Common/PinYin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public static String GetFirst(String str)
if (str.IsNullOrEmpty()) return String.Empty;

var rs = GetAll(str);
return rs.Select(e => e[0]).Join("");
return rs.Where(e => !e.IsNullOrEmpty()).Select(e => e[0]).Join("");
}

///// <summary>取各字符的拼音首字母</summary>
Expand Down

0 comments on commit 0f6ecc7

Please sign in to comment.