MultiTrim

Trims leading and trailing tabs, spaces and Enters
Code has lines to work in VBA too, as it is working for VBScript (ASP Classic)

CodeFunctionName
What is this?

Public

Tested

Imported
Function MultiTrim(ByVal TextData)
    ' Trims leading and trailing tabs, spaces and enters
    Dim textRegExp
    ' Set textRegExp = CreateObject("VBScript.RegExp") ' in VBA
    Set textRegExp = New regexp ' in Classic ASP
    textRegExp.Pattern = "\s{0,}(\S{1}[\s,\S]*\S{1})\s{0,}"
    textRegExp.Global = False
    textRegExp.IgnoreCase = True
    textRegExp.MultiLine = True
    If textRegExp.Test(TextData) Then
        MultiTrim = textRegExp.Replace(TextData, "$1")
    Else
        MultiTrim = ""
    End If
End Function

ByVal TextData

Views 91

Downloads 46

CodeID
DB ID