前段时间在写药品管理程序,需要生成药品的拼音简码和通过拼音简码搜索药品。我觉得信息管理程序基本上都会用到。就分享给大家,其中的代码一部分是通过网络获得,遗憾的是没有记住分享的大大的名字,这里顺致敬意。
Imports Microsoft.International.Converters.PinYinConverter
Public Class Classchineseconvert
Public Shared Function GetPinYin(ByVal t1 As String) As String
'取得输入行字的拼音码
On Error Resume Next
Dim sOne, sChar, sRet As String, i As Integer
For i = 1 To Len(t1)
sChar = Mid(t1, i, 1)
sOne = ""
If Asc(sChar) > 0 Then
If UCase(sChar) <= "Z" And UCase(sChar) >= "A" Then
sOne = UCase(sChar)
Else
sOne = ""
End If
Else : Dim chinesechar As New ChineseChar(sChar)
sOne = chinesechar.Pinyins(0).Chars(0)
'ElseIf Asc(sChar) >= Asc("啊") And Asc(sChar) < Asc("
Imports Microsoft.International.Converters.PinYinConverter
Public Class Classchineseconvert
Public Shared Function GetPinYin(ByVal t1 As String) As String
'取得输入行字的拼音码
On Error Resume Next
Dim sOne, sChar, sRet As String, i As Integer
For i = 1 To Len(t1)
sChar = Mid(t1, i, 1)
sOne = ""
If Asc(sChar) > 0 Then
If UCase(sChar) <= "Z" And UCase(sChar) >= "A" Then
sOne = UCase(sChar)
Else
sOne = ""
End If
Else : Dim chinesechar As New ChineseChar(sChar)
sOne = chinesechar.Pinyins(0).Chars(0)
'ElseIf Asc(sChar) >= Asc("啊") And Asc(sChar) < Asc("