📄 编程补充题3.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "处理字符串"
ClientHeight = 2865
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2865
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "处理"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3000
TabIndex = 3
Top = 1440
Width = 975
End
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1260
ItemData = "编程补充题3.frx":0000
Left = 120
List = "编程补充题3.frx":0007
TabIndex = 2
Top = 1440
Width = 1575
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 1
Text = " "
Top = 600
Width = 4455
End
Begin VB.Label Label2
Caption = "数字串内容"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.Label Label3
Caption = " "
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2280
TabIndex = 4
Top = 2280
Width = 2175
End
Begin VB.Label Label1
Caption = "字符串内容"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 0
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub command1_click()
k = 0
n = -1
s = Text1.Text '取字符串
For i = 1 To Len(s) '按顺序逐个字符判断
t = Mid(s, i, 1) '取i位置的一个字符
If t < "0" Or t > "9" Then '判是否数字
k = 0 '非数字,置k=0
Else
If k = 0 Then
n = n + 1 '指向列表框的下一行
List1.List(n) = t '存入列表框
k = 1 '表示刚存过数字
Else
'把数字加入到列表框当前行的末尾
List1.List(n) = List1.List(n) + t
End If
End If
Next i
Label3.Caption = Str(n + 1) + "个数字串"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -