|
-
Apr 14th, 2000, 07:18 PM
#1
Thread Starter
Member
Using a tab-delimited ASCII text file, how can I read column titles and row titles into string arrays in the following format:
var1 var2 var3 var4 var5 var6
row1 0.00 0.00 0.00 0.00 0.00 0.00
row2 0.00 0.00 0.00 0.00 0.00 0.00
row3 0.00 0.00 0.00 0.00 0.00 0.00
row4 0.00 0.00 0.00 0.00 0.00 0.00
row5 0.00 0.00 0.00 0.00 0.00 0.00
I can read in the numeric data without any problem.
What method works best for reading each column title at each tab position, and what's the trick for detecting the carriage return at the end of the first row to force reading in the next row?
Thanks,
-LP
-
Apr 14th, 2000, 08:11 PM
#2
Fanatic Member
in VB6 (Not VB5) you can use the split function,
DynamArray = Split(StrRow1, " " )
this fills a zero base dynamic array of strings of the vars, use ubound(DynamArray) to find out how many vars are present
-
Apr 14th, 2000, 09:56 PM
#3
Thread Starter
Member
in VB6 (Not VB5) you can use the split function,
DynamArray = Split(StrRow1, " " )
this fills a zero base dynamic array of strings of the vars, use ubound(DynamArray) to find out how many vars are present
Thanks Paul:
On other thing - a user has variable names with breaks, i.e. "alpha 1", "alpha 2", etc., but there is definately a tab character that I can see between the varnames. Split function wants a string delimiter such as " " rather than chr(10), so I cannot pick off tabs. Any suggestions on how to count tabs in a string rather than looking for " "?
-
Apr 14th, 2000, 10:16 PM
#4
Fanatic Member
the split function will take any string as a delimitor, I often write text files with "##" as a delimeter because you don't usually come across it, I know you can use vbTab (or vbCrLF for line splitting) in there, if 'chr(10)' doesn't work try 'chr$(10)' or set a string variable to chr(10) and put the variable in there.
I've had almost any combination work,
Good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|