11.編“字符串縮寫”程序,實現如下功能:在文本框Text1中輸入Ascii字符串,字符串中如果有由Ascii表中相鄰字符(升序)組成的子串,則把該子串縮寫成由第一個字符、“-”和最后一個字符組成,比如“abcdfpxcba”則縮寫成“a-dfpxcba”。程序運行界面如圖所示。 (1)代碼“Private Sub Command1_Click ( )”中的Command1是
(單選,填字母:A.對象名/B.事件/C.事件處理過程) (2)實現上述功能的VB程序如下,請在橫線處填入合適的代碼。 Private Sub Command1_Click ( ) Dim s As String,result As String,i As Integer,j As Integer,t As Integer s=Text1.Text:t=Len(s):result=““ i=1 Do While i<=t j=i Do While i<t If Asc(Mid(s,i+1,1))=Asc(Mid(s,i,1))+1Then i=i+1 Else Exit Do End If Loop If i>j Then result=①
Else result=result+Mid(s,i,1) End If i=i+1 Loop Text2.Text=②