⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmteststringclasses.frm

📁 字符串操作完全演示.zip字符串操作完全演示.zip
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Width           =   1755
         End
      End
      Begin VB.Frame Frame5 
         Caption         =   "Is Date DDMMYYYY?"
         Height          =   2175
         Left            =   -74760
         TabIndex        =   6
         Top             =   480
         Width           =   7815
         Begin VB.TextBox txtDate 
            Height          =   285
            Left            =   1680
            TabIndex        =   11
            Top             =   360
            Width           =   1935
         End
         Begin VB.CommandButton cmdYes 
            Caption         =   "Yes"
            Height          =   375
            Left            =   4560
            TabIndex        =   10
            Top             =   600
            Width           =   735
         End
         Begin VB.CommandButton cmdNo 
            Caption         =   "No"
            Height          =   375
            Left            =   5640
            TabIndex        =   9
            Top             =   600
            Width           =   855
         End
         Begin VB.CheckBox chkCentury 
            Caption         =   "Century not req'd"
            Height          =   255
            Left            =   1740
            TabIndex        =   8
            Top             =   960
            Width           =   1935
         End
         Begin VB.TextBox txtDateResult 
            BackColor       =   &H00FFFFFF&
            Enabled         =   0   'False
            Height          =   285
            Left            =   1680
            Locked          =   -1  'True
            TabIndex        =   7
            Top             =   1440
            Width           =   2055
         End
         Begin VB.Label Label15 
            Caption         =   "The default separator for dates is ""/"".  Enter characters in the delimiter list for different separators."
            Height          =   795
            Left            =   4080
            TabIndex        =   53
            Top             =   1200
            Width           =   3375
         End
         Begin VB.Label Label5 
            Caption         =   "Yes enabled when date is valid"
            Height          =   255
            Left            =   4200
            TabIndex        =   43
            Top             =   360
            Width           =   2715
         End
         Begin VB.Label Label4 
            Caption         =   "Result"
            Height          =   255
            Left            =   840
            TabIndex        =   42
            Top             =   1440
            Width           =   615
         End
         Begin VB.Label Label3 
            Caption         =   "Enter Date Here"
            Height          =   255
            Left            =   120
            TabIndex        =   41
            Top             =   360
            Width           =   1455
         End
      End
      Begin VB.Frame Frame1 
         Caption         =   "Delimiter List"
         Height          =   2175
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   7815
         Begin VB.TextBox txtDelimiter 
            Height          =   285
            Left            =   1560
            TabIndex        =   5
            Top             =   360
            Width           =   1455
         End
         Begin VB.ListBox lstDelimiter 
            Height          =   600
            Left            =   1560
            TabIndex        =   4
            Top             =   840
            Width           =   1455
         End
         Begin VB.CommandButton cmdAddDelimiter 
            Caption         =   "Add"
            Height          =   375
            Left            =   3360
            TabIndex        =   3
            Top             =   480
            Width           =   975
         End
         Begin VB.CommandButton cmdClearDelimiters 
            Caption         =   "Clear"
            Height          =   375
            Left            =   3360
            TabIndex        =   2
            Top             =   960
            Width           =   975
         End
         Begin VB.Label Label22 
            Caption         =   "See the individual tabs for instructions."
            Height          =   435
            Left            =   4560
            TabIndex        =   60
            Top             =   1140
            Width           =   3015
         End
         Begin VB.Label Label16 
            Caption         =   "The delimiter list is used in ""Is Date DDMMYYYY"", ""Word Popper"" and ""Is Char Allowed"""
            Height          =   675
            Left            =   4560
            TabIndex        =   54
            Top             =   360
            Width           =   2895
         End
         Begin VB.Label Label2 
            Caption         =   "Current delimiters"
            Height          =   495
            Left            =   600
            TabIndex        =   40
            Top             =   840
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "Delimiter"
            Height          =   255
            Left            =   600
            TabIndex        =   39
            Top             =   360
            Width           =   735
         End
      End
   End
End
Attribute VB_Name = "frmTestClasses"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub chkCentury_Click()

    txtDate_Change
    
End Sub


Private Sub chkfrcase_Click()

    cmdFR_Click
    
End Sub


Private Sub chkpopCase_Click()

    cmdPop_Click
    
End Sub

Private Sub chkRemCase_Click()

    cmdRemove_Click
    
End Sub

Private Sub cmdAddDelimiter_Click()

Dim i As Integer

    If Len(txtDelimiter) = 0 Then
        Beep
        Exit Sub
    End If
    
    'see if exists first
    For i = 0 To lstDelimiter.ListCount - 1
        If lstDelimiter.List(i) = txtDelimiter Then
            Beep
            Exit Sub
        End If
    Next i
    
    lstDelimiter.AddItem txtDelimiter
    
End Sub

Private Sub cmdClearDelimiters_Click()

    lstDelimiter.Clear
    
End Sub

Private Sub cmdFR_Click()

    If Len(txtStrToFR) = 0 _
        Or Len(txtSrch) = 0 Then
        
        Beep
        Exit Sub
    End If
    
Dim s As New clsStrings
Dim res As Variant

    txtResult = s.ReplaceString(txtStrToFR, txtSrch, txtRep, chkFRCase) & ""
    
End Sub

Private Sub cmdLower_Click()
Dim s As New clsStrings

    txtMiscTo = s.ToLowerCase(txtMiscFrom)

End Sub

Private Sub cmdPop_Click()

    If Len(txtPopStr) = 0 Then
        Beep
        Exit Sub
    End If
    
Dim s As New clsStringAnalyser
Dim c As New Collection
Dim i As Integer
Dim res As Variant

    If lstDelimiter.ListCount > 0 Then
        For i = 0 To lstDelimiter.ListCount - 1
            c.Add lstDelimiter.List(i)
        Next i
    End If
    
    lstPopStrings.Clear
    
    If lstDelimiter.ListCount > 0 Then
        res = s.PopWord(txtPopStr, chkpopCase, c)
    Else
        res = s.PopWord(txtPopStr, chkpopCase)
    End If
        
    Do While Not IsNull(res)
        If Len(res) > 0 Then
            lstPopStrings.AddItem res
        End If
        res = s.PopWord
    Loop
        
End Sub

Private Sub cmdProper_Click()
Dim s As New clsStrings

    txtMiscTo = s.Proper(txtMiscFrom)

End Sub

Private Sub cmdRemove_Click()

    If Len(txtstrRem) = 0 Or _
        Len(txtstrToRem) = 0 Then
        
        Beep
        Exit Sub
    End If
    
Dim s As New clsStrings

    txtRemResult = s.RemoveString(txtstrRem, txtstrToRem, chkRemCase)
    
End Sub


Private Sub cmdToggle_Click()
Dim s As New clsStrings

    txtMiscTo = s.ToGgLeCaSe(txtMiscFrom)

End Sub

Private Sub cmdUpper_Click()

Dim s As New clsStrings

    txtMiscTo = s.ToUpperCase(txtMiscFrom)
    
End Sub

Private Sub Form_Load()

    lstDelimiter.Clear

End Sub

Private Sub Form_Unload(Cancel As Integer)

    End
    
End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)

Dim s As New clsStrings
Dim c As New Collection
Dim i As Integer
Dim res As Variant

    'let backspace through
    If KeyAscii = 8 Then
        Exit Sub
    End If
    
    If lstDelimiter.ListCount > 0 Then
        For i = 0 To lstDelimiter.ListCount - 1
            c.Add lstDelimiter.List(i)
        Next i
        
        If Not s.IsCharIn(Chr(KeyAscii), c) Then
            KeyAscii = 0
        End If
    Else
        KeyAscii = 0
    End If
    
    
End Sub


Private Sub txtDate_Change()

Dim s As New clsStrings
Dim res As Variant
Dim c As New Collection
Dim i As Integer
    
    If lstDelimiter.ListCount > 0 Then
        For i = 0 To lstDelimiter.ListCount - 1
            c.Add lstDelimiter.List(i)
        Next i
        res = s.IsDateDDMMYYYY(txtDate, chkCentury, c)
    Else
        res = s.IsDateDDMMYYYY(txtDate, chkCentury)
    End If
    
    
    If Not IsNull(res) Then
        txtDateResult = res
        cmdYes.Enabled = True
        cmdNo.Enabled = False
    Else
        txtDateResult = ""
        cmdYes.Enabled = False
        cmdNo.Enabled = True
    End If
    
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -