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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array of strings

Status
Not open for further replies.

cpanon

Programmer
Joined
Feb 5, 2007
Messages
5
Location
US
Hello
Is/how possible to dimension a array that has the i dimension of an integer and the j dimension of an array that is a parsed string.

What I am doing is reading a file line by line. On each line I am parsing it into a string array. I want to then store in an other array(or is it technically a vector) those parsed lines that became a string array. I then want to be able to access each element of each line for all lines using LBound and UBound on the string array or j dimension.

How scrambled is this? Can it be done easily?
 




Hi,

Take a look at the ReDim Perserve statement.

Skip,

[glasses] [red][/red]
[tongue]
 
Hi Skip
Thanks, but how?
Do I create an array of int then redim it by some syntax to add an array of strings? Then can I access by incrementing the i dimension and somehow looping over the j dimension which will have variable length.
 
Hi,

a) side remark: it's nothing perverse, but Redim Preserve
[tongue]

b) Are these many strings?
Arrays can get quite a resource load.

Have you thought about storing the strings into any sort of database and querying THAT?
[ponder]

[blue]Help us, join us, participate
IAHRA - International Alliance of Human Rights Advocates[/blue]
 
You can work with variant array that stores string arrays. The sample:

Dim x() As Variant
Dim strArray() As String
ReDim strArray(1 To 2)
strArray(1) = "one"
strArray(2) = "two"
ReDim Preserve x(1 To 1)
x(1) = strArray
Erase strArray
strArray = x(1)
MsgBox strArray(1)

combo
 
cpanon,
Just for grins and giggles, what is the format of your file? If it's a 'standard' flat file format you could just open the file as a recordset which would split the file into records/fields in one step.

Just a thought,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top