Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Information on how to look at a text file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
After I open a text file, I am trying to loop through the information for delimeters. I am stuck. Please help.

When I try to read the information I am getting the length of the information. I need the information and not the lemgth.
 
If you are not sure of the structure or the delimiters, open the file in [notepad | wordpad] and examine it.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Say you have something like this:

text,text1,text2,text3
text4,text5,text6,text7

The above pattern is called comma delimited, but really any delimiter can be used as long as it is unique, ie it does not appear anywhere in the information.


All you have to do is open the file

dim temp as string
dim tempArray() as string

open myText.txt for read as 1
Line Input #1, temp 'temp is used to store the line
temparray = split(temp,",") 'This line will split the raw line up based on the comma
'Do whatever else that you need to do with tokens....


close #1

hope this helps you....


Troy Williams B.Eng.
fenris@hotmail.com

 
I you are trying to find a delimiter to use....I think that's what you are asking.....consider opening the textfile in Excel and try different delimiter options.

If you are try to programatically return values and not lengths then post back and I'll give you the code.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top