以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  列遍历转换求助  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=83425)

--  作者:daxis0225
--  发布时间:2016/4/8 15:36:00
--  列遍历转换求助

Dim sts() As String = {"孙小子","张麻子","魏武大帝","秦光"}
For Each st As String In sts
    Dim x1 As String = StrToTitleCase(GetPy(st.SubString(0,1)))
   \' Output.Show(x1)
    Dim m1 As String = getpy(st.SubString(1))
    Dim m3() As String
    m3 = m1.split(" ")
    For Index As Integer = 0 To m3.length -1
        \'Output.Show(m3(Index))
    Next
    Dim Str1 = String.Join("", m3) 
    Dim m5 As String = StrToTitleCase(Str1)
   \' Output.Show(m5)
Dim zh As String
zh = x1 & " " & m5

    Output.Show(zh)
Next

 

以上代码输出结果为

Sun Xiaozi
Zhang Mazi
Wei Wudadi
Qin Guang

 

现在我有一列姓名的数据,希望在另一列,显示同样效果的汉语拼音,请大师赐教。


--  作者:大红袍
--  发布时间:2016/4/8 16:03:00
--  

DataColChanged事件

 

If e.DataCol.name = "第二列" Then
    If e.NewValue > "" Then
        e.DataRow("第三列") = GetPy(e.NewValue)
    Else
        e.DataRow("第三列") = nothing
    End If
End If