📄 string.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "String Processing spla@earthling.net"
ClientHeight = 5325
ClientLeft = 4680
ClientTop = 3135
ClientWidth = 5940
LinkTopic = "Form1"
ScaleHeight = 5325
ScaleWidth = 5940
Begin VB.TextBox txtDoThis
Height = 195
Left = 2760
TabIndex = 15
Top = 1320
Visible = 0 'False
Width = 2655
End
Begin VB.CommandButton Command3
Caption = "Exit"
Height = 495
Left = 3360
TabIndex = 14
Top = 4080
Width = 2055
End
Begin VB.CommandButton cmdGet_File
Caption = "Get File"
Height = 495
Left = 3360
TabIndex = 13
Top = 3480
Width = 2055
End
Begin MSComDlg.CommonDialog Cdlg
Left = 3840
Top = 3720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Index = 4
Left = 2880
TabIndex = 7
Top = 4440
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Index = 3
Left = 2880
TabIndex = 6
Top = 4080
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Index = 2
Left = 2880
TabIndex = 5
Top = 3720
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Index = 1
Left = 2880
TabIndex = 4
Top = 3360
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Index = 0
Left = 2880
TabIndex = 3
Top = 3000
Width = 255
End
Begin VB.TextBox txtResult
Height = 975
Left = 360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top = 1560
Width = 5055
End
Begin VB.CommandButton Command1
Caption = "Process String"
Height = 495
Left = 3360
TabIndex = 1
Top = 2880
Width = 2055
End
Begin VB.TextBox txtEnter
Height = 855
Left = 360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 360
Width = 5055
End
Begin VB.Line Line4
BorderStyle = 6 'Inside Solid
X1 = 360
X2 = 3240
Y1 = 4800
Y2 = 4800
End
Begin VB.Line Line3
BorderStyle = 6 'Inside Solid
X1 = 360
X2 = 360
Y1 = 2880
Y2 = 4800
End
Begin VB.Line Line2
BorderStyle = 6 'Inside Solid
X1 = 3240
X2 = 3240
Y1 = 2880
Y2 = 4800
End
Begin VB.Line Line1
BorderStyle = 6 'Inside Solid
X1 = 360
X2 = 3240
Y1 = 2880
Y2 = 2880
End
Begin VB.Label Label8
Caption = "Select an option"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 960
TabIndex = 18
Top = 2640
Width = 1695
End
Begin VB.Label Label7
Caption = "Result"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 17
Top = 1320
Width = 2175
End
Begin VB.Label Label3
Caption = "Enter a string to process"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 16
Top = 120
Width = 2175
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
Caption = "Keep Something You Choose"
Height = 255
Left = 120
TabIndex = 12
Top = 4440
Width = 2655
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
Caption = "Keep Only Numbers and Letters"
Height = 255
Left = 120
TabIndex = 11
Top = 4080
Width = 2655
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
Caption = "Keep Only Upper Case Letters"
Height = 255
Left = 120
TabIndex = 10
Top = 3720
Width = 2655
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Keep Only Lower Case Letters"
Height = 255
Left = 120
TabIndex = 9
Top = 3360
Width = 2655
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "Keep Only Numbers"
Height = 255
Left = 120
TabIndex = 8
Top = 3000
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'<><><><><><><><><><><><><><><><>
'Written by Richard Leonard spla@earthling.net
'<><><><><><><><><><><><><><><><>
Private Sub Command1_Click()
Dim i As Integer
Dim User_String As String
On Error GoTo errorhandler
Select Case True
Case Option1(0)
Form1.txtDoThis.Text = "[ 0-9]"
Case Option1(1)
Form1.txtDoThis.Text = "[ a-z]"
Case Option1(2)
Form1.txtDoThis.Text = "[ A-Z]"
Case Option1(3)
Form1.txtDoThis.Text = "[ AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789]"
Case Option1(4)
User_String = InputBox("Enter the characters you want to keep. For example if you want to keep T's and only T's then enter Tt")
Form1.txtDoThis.Text = "[ " & User_String & "]"
Case Else
MsgBox "Please select one of the options to tell the program how you want the string to be processed."
End Select
txtResult.Text = CheckString(txtEnter)
Exit_it:
Exit Sub
errorhandler:
MsgBox Err.Number & " " & Err.Description
Resume Exit_it
End Sub
Private Sub cmdGet_File_Click()
Dim textLine As String
Dim textEnter As String
Cdlg.CancelError = True
On Error GoTo ErrHandler
Cdlg.Flags = cdlOFNHideReadOnly
' Set filters
Cdlg.Filter = "All Files (*.*)|*.*|Text Files" & _
"(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
Cdlg.FilterIndex = 2
Cdlg.ShowOpen
Screen.MousePointer = vbHourglass
If Dir(Cdlg.FileName) <> "" Then
Open Cdlg.FileName For Input As #1
While Not EOF(1)
Line Input #1, textLine
txtEnter = txtEnter & textLine
Wend
Close #1
Screen.MousePointer = vbDefault
Else
Screen.MousePointer = vbDefault
MsgBox "File not found"
End If
Exit Sub
ErrHandler:
'User pressed the Cancel button
Exit Sub
End Sub
Private Sub Command3_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -