Parsing a Text Variable

Hello,

I am extracting and unencypting a small text file (sFilePath) that contains multiple lines to a variable (sFileChunk).  Once I have the variable how can I loop through each "line" as I would using the FileSystemObject f.ReadLine method?

I cannot use the ReadLine method as the usable contents are in variable.  I do not want to write it out to a temp file to do this for security reasons.

What can you recommend?


Thanks.

Michael
'Get File Contents
dim fso,f, sFileChunk
set fso = Server.CreateObject("Scripting.FileSystemObject")
set f = fso.OpenTextFile(sFilePath, 1)
sFileChunk = decrypt(f.ReadAll)
f.Close

Open in new window

michael4606Asked:
Who is Participating?
 
saoirse1916Connect With a Mentor Commented:
You should be able to split the file into an array using the newline character as a delimiter:
<%
arrLines = Split(sFileChunk, vbCrLf)
'     Now cycle through the array to operate on each line
For i = 0 to uBound(arrLines)
     Response.Write(arrLines(i) & "<br>")
Next
%>
0
 
michael4606Author Commented:
Perfect!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.