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

📄 modword.bas

📁 字符串分解程序
💻 BAS
字号:
Attribute VB_Name = "modWord"
Option Explicit



' #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
'   ParseString: Parses the string into multiple words
' #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
Public Function ParseString(StringToParse As String, _
    Optional Delimiter As String = " ") As Collection
    
    Dim colTemp     As Collection
    Dim objWord     As Word
    
    Dim lngStartPos As Long
    Dim lngNextPos  As Long
    
    Dim strTemp     As String
    
    ' Initialize the StartPosition and the Collection
    lngStartPos = 1
    Set colTemp = New Collection
    
    Do
        ' Clear any reference to a previous word
        Set objWord = Nothing
        
        ' Search the string
        lngNextPos = InStr(lngStartPos, StringToParse, Delimiter)
        
        If lngNextPos = 0 Then
            ' For when we get to the end of the file
            strTemp = Mid$(StringToParse, lngStartPos, Len(StringToParse) - lngNextPos + 1)
        Else
            strTemp = Mid$(StringToParse, lngStartPos, lngNextPos - lngStartPos + 1)
        End If
    
        lngStartPos = lngNextPos + 1
        
        Set objWord = New Word
        
        objWord.Value = strTemp
        colTemp.Add objWord
        DoEvents
    
    Loop Until lngNextPos = 0
    
ParseString_Exit:
    Set ParseString = colTemp
    Set objWord = Nothing
    Set colTemp = Nothing
End Function



⌨️ 快捷键说明

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