怎么用VB设计一个程序实现删除每一行中的某些字符符号
比如下面将这一段内容:(芬厄狼,939711)[zVaUWpNTS](enjo错位,1273577)[OdyKNTa](liufb3,9166621)[1OoyKNTd]...
比如下面将这一段内容:
(芬厄狼,939711)[zVaUWpNTS]
(enjo错位,1273577)[OdyKNTa]
(liufb3,9166621)[1OoyKNTd]
(豆浆不解酒醉,335453)[o1OvyKNTfk]
(时光若星辰v,14776676)[nIo1O5yKNTV]
(扯淡青春8188,4418936)[ByKNTLT]
(BLon381,3518679)[rIo1PKyKNTd]
转换为下面这样(即把[]里的内容去掉,把括号去掉,把里面的逗号,换成冒号:)
芬厄狼:939711
enjo错位:1273577
liufb3:9166621
豆浆不解酒醉:335453
时光若星辰v:14776676
扯淡青春8188:4418936
BLon381:3518679
用下面的这个界面,代码应该怎么写,求大神帮忙,成功了会追加! 展开
(芬厄狼,939711)[zVaUWpNTS]
(enjo错位,1273577)[OdyKNTa]
(liufb3,9166621)[1OoyKNTd]
(豆浆不解酒醉,335453)[o1OvyKNTfk]
(时光若星辰v,14776676)[nIo1O5yKNTV]
(扯淡青春8188,4418936)[ByKNTLT]
(BLon381,3518679)[rIo1PKyKNTd]
转换为下面这样(即把[]里的内容去掉,把括号去掉,把里面的逗号,换成冒号:)
芬厄狼:939711
enjo错位:1273577
liufb3:9166621
豆浆不解酒醉:335453
时光若星辰v:14776676
扯淡青春8188:4418936
BLon381:3518679
用下面的这个界面,代码应该怎么写,求大神帮忙,成功了会追加! 展开
2个回答
展开全部
晕 这么多大神都发了 我都写好了 不发也浪费了 求前楼的理解
Option Explicit
Private Sub Form_Load()
'多行Text控件属性
'1:是否启用多行(仅能在控件属性窗口设置)
'Text1.MultiLine = True
'2:是否设置滚动条(仅能在控件属性窗口设置)
'Text1.ScrollBars = 2
'界面初始化
Command1.Caption = "转换格式"
Command2.Caption = "退出"
Text1.Text = ""
Text2.Text = ""
'''''''''''预设信息''''''''''''''
Text1.Text = Text1.Text & "(芬厄狼,939711)[zVaUWpNTS]" & vbCrLf
Text1.Text = Text1.Text & "(enjo错位,1273577)[OdyKNTa]" & vbCrLf
Text1.Text = Text1.Text & "(liufb3,9166621)[1OoyKNTd]" & vbCrLf
Text1.Text = Text1.Text & "(豆浆不解酒醉,335453)[o1OvyKNTfk]" & vbCrLf
Text1.Text = Text1.Text & "(时光若星辰v,14776676)[nIo1O5yKNTV]" & vbCrLf
Text1.Text = Text1.Text & "(扯淡青春8188,4418936)[ByKNTLT]" & vbCrLf
Text1.Text = Text1.Text & "(BLon381,3518679)[rIo1PKyKNTd]" & vbCrLf
'''''''''''''''''''''''''''''''''
End Sub
'转换格式按钮
Private Sub Command1_Click()
Text2.Text = ""
'按格式读出多行Text或读取某行的信息
Dim Tmpt() As String
Dim T2str As String
Dim i As Integer
Tmpt = Split(Text1.Text, vbCrLf)
For i = LBound(Tmpt) To UBound(Tmpt)
If Tmpt(i) <> "" Then
'遍历到的每行信息
'处理字符串
Dim Tmpstr() As String
Tmpstr = Split(Tmpt(i), ")")
Tmpstr = Split(Tmpstr(0), "(")
T2str = Replace(Tmpstr(1), ",", ":")
'处理完成后的信息输出到Text2.Text
Text2.Text = Text2.Text & T2str & vbCrLf
End If
Next i
End Sub
'退出按钮
Private Sub Command2_Click()
End
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询