|
謝樓主程式~
加一句, 令 "標點" 或者那些 "不能轉換的字" 直接輸出 (當然最好在函数加一個参数控制)
方便整篇文章轉換
Public Function GetPinYin(HzStr As String) As String
Dim i As Integer
Dim tmpStr As String
GetPinYin = ""
If HzStr <> "" Then
If pvUseSeperator Or pvInitialOnly Then
For i = 1 To Len(HzStr)
tmpStr = IFELanguage_GetMorphResult(Mid(HzStr, i, 1))
If tmpStr <> "" Then
If pvInitialOnly Then
GetPinYin = GetPinYin & GetInitial(tmpStr) & pvSeperator
Else
GetPinYin = GetPinYin & tmpStr & pvSeperator
End If
Else: GetPinYin = GetPinYin & Mid(HzStr, i, 1) '直接輸出未能轉換的字
End If
Next
If Len(GetPinYin) > 0 Then GetPinYin = Left(GetPinYin, Len(GetPinYin) - 1)
Else
GetPinYin = IFELanguage_GetMorphResult(HzStr)
End If
End If
End Function |
|