Parsing a Text Variable

Posted on 2008-11-11
Medium Priority
Last Modified: 2012-05-05

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?


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

Open in new window

Question by:michael4606

Accepted Solution

saoirse1916 earned 500 total points
ID: 22930443
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>")

Author Closing Comment

ID: 31515508

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question