< Public Function BlankOutQuotes ( OneLine As String, Optional ByVal BlankingCharacter As String = " ", Optional QuotesCharacter As String = "" ) As String (?)

Comments

'------------------------------------------------------------------------- 'Takes a string, and replaces everything within the quotes with a standard character 'Useful for not getting distracted with a search string appearing within quotes 'does not include the quotes themselves in the blanked portion '-------------------------------------------------------------------------

Public Function BlankOutQuotes ( OneLine As String, Optional ByVal BlankingCharacter As String = " ", Optional QuotesCharacter As String = "" ) As String


    Dim outText As String
    Dim i As Integer
    Dim Char As String
    Dim bInQuotes As Boolean
    
    bInQuotes = False
    BlankingCharacter = Left(BlankingCharacter, 1)
    
    If QuotesCharacter = "" Then QuotesCharacter = Quotes
    
    If Len(OneLine) = 0 Then Exit Function
    
    For i = 1 To Len(OneLine)
        Char = Mid(OneLine, i, 1)
        
        If Char = QuotesCharacter Then
            bInQuotes = Not bInQuotes
        End If
        
        If (Not bInQuotes) Or (Char = QuotesCharacter) Then
            outText = outText & Char
        Else
            outText = outText & BlankingCharacter
        End If
        
    Next i
    
    BlankOutQuotes = outText
End Function


Copying, Return to index