how to merg function in my vb script code

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
my vb script is relate to remove all white space from my text file
my function is:-
Function MultilineTrim (Byval TextData)
Dim textRegExp Set textRegExp= new regexp
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
MultilineTrim = textRegExp.Replace(TextData, "$1")
Else
MultilineTrim = ""
End If
End Function

my vb script code is :-
Const ForReading = 1
Const ForWriting = 2
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("D:SITA.txt", ForReading)
strText = objFile.ReadAll
objFile.Close

strNewText = Replace(strText,vbCrLf, "~")

Set objFile = objFSO.OpenTextFile("D:SITA1.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close


how to merg both please give me actual code

View the full article
 
Back
Top