'''
Dim str1 As String
Dim str2 As String = " "
Dim str3 As String = " "
Dim str4 As String = " "
Select Case e.DataCol.name
Case "字词"
If e.DataRow.IsNull("字词") Then
e.DataRow("数字代码") = Nothing '如果为空,则清除数字代码
e.DataRow("拼音") = Nothing '如果为空,则清除拼音
Else
' For i As Integer = 0 To e.DataRow("字词").Length -1
' str1 = e.DataRow("字词").SubString(i,1) '从字词中选取1个字符
' str2 = str2 & str1 & "/"
' e.DataRow("数字代码") =str2 '写入数字代码
' Next
Dim Value As String = e.DataRow("字词")
Dim sps() As Char = {"/","|",",","。",",","!","!","?","?" }
Dim Names() As String = Value.Split(sps)
For Each name As String In Names
str3 = str3 & GetPinYin(name) & "/" '分隔符内词转换成拼音
Next
e.DataRow("拼音") = str3.Trim("/")
End If
Case "拼音"
If e.DataRow.IsNull("拼音") Then
e.DataRow("数字代码")= Nothing
Else
Dim Value As String = e.DataRow("拼音")
Dim Values1() As String
Dim Values2() As String
Values1 = value.split("/")
For Index1 As Integer = 0 To Values1.Length - 1
' msgbox(Values1.Length - 1)
' Values1 = Multi.split("/")
' For Index1 As Integer = 0 To values1.Length - 1
' msgbox(multi.Length - 1)
' msgbox(Values1(Index1))
Values2 = Values1(Index1).trim().split(" ") '赋值拼音分隔符内拼音为Values2
Dim strv As String = ""
For Index2 As Integer = 0 To Values2.Length - 1
' msgbox(values2(Index2))
' msgbox(Values2.Length - 1)
Dim p1 As String = Values2(Index2).SubString(0,1) '定义p1为Values2中第一个拼音第1个字符,如qing ming 中的“q"
Dim p2 As String = Values2(Index2).SubString(0,2)'定义p2为Values2中第一个拼音第2个字符,如shui ji 中的“sh"
Dim p10 As String = Values2(Index2).SubString(1)'定义p10为Values2中第一段拼音,如2 shui ji中的第一个拼音shui
Dim p20 As String = Values2(Index2).SubString(2)'定义p20为Values2中第二段拼音,如2 shui ji中的第二个拼音ji
'分辨声母是否为"zh"/"ch"/"sh"
If p2 = "zh" OrElse p2 = "ch" OrElse p2 = "sh" Then
Dim dr1 As DataRow = DataTables("表A").Find("'/'+ [第二列]+'/' like '%/" & p2 & "/%' ") '从表A中拼音声母中寻找p2,即zh/ch/sh对应的数字代码
Dim dr2 As DataRow = DataTables("表A").Find("'/'+ [第三列]+'/' Like '%/" & p20 & "/%' ")'从表A中数字代码韵母中寻找P
If dr1 Is Nothing Then
strv = strv & ","
Else
strv = strv & "," & dr1("第一列") & "-" & dr2("第一列")
End If
Else
' msgbox(Values2(Index2).SubString(0,1))
' msgbox(Values2(Index2).SubString(1))
Dim dr3 As DataRow = DataTables("表A").find("'/'+ [第二列]+'/' like '%/" & p1 & "/%' ")
Dim dr4 As DataRow = DataTables("表A").find("'/'+ [第三列]+'/' Like '%/" & p10 & "/%' ")'
If dr3 Is Nothing Then
strv = strv & ","
Else
strv = strv & "," & dr3("第一列") & "-" & dr4("第一列")
End If
End If
Next
e.DataRow("数字代码") = e.DataRow("数字代码") & "/" & strv.Trim(",")
Next
e.DataRow("数字代码") = e.DataRow("数字代码") .trim("/")
End If
End Select