memory use - string or array of strings

memory use - string or array of strings

Anonymous
Not applicable
341 Views
3 Replies
Message 1 of 4

memory use - string or array of strings

Anonymous
Not applicable
Hi,

I want to read a text file into memory and then examine elements in the
string/s looking for various structures or characters and divide the string
according to such characters. The characters and structures will possibly
span multiple lines of the text file with no set format I can rely on so I
need to in effect ignore the original line breaks in the text file and look
only at it's string/text values.

Are there any memory issues I should consider if I want to read a text file
into a string variable?

The question is should I read it into one giant string and then process
that - or -
should I read it into an array of strings (one string for each line in
file). Is there a limit to the size of a string variable in vb? vba?

My processing will have to look through the resultant structure (spanning
lines of the original file) or basically ignoring the division into lines
that the file has.
That would possibly be an advantage in putting the whole file into one
string- then my parsing routine doesn't need a bunch of code to jump to next
line (item in array) and can just move through the string start to end.

any thoughts on this?
Thanks,
mark
0 Likes
342 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Hi Mark,

The documentation will tell you the max length of a string. I would see
advantages in putting as much in a single string as possible as you can then
use the "split" command to break the string down into a variant array.

--


Laurie Comerford
CADApps
www.cadapps.com.au

"Mark Propst" wrote in message
news:8C48E983D2642DA66C942983291A00F0@in.WebX.maYIadrTaRb...
> Hi,
>
> I want to read a text file into memory and then examine elements in the
> string/s looking for various structures or characters and divide the
string
> according to such characters. The characters and structures will possibly
> span multiple lines of the text file with no set format I can rely on so I
> need to in effect ignore the original line breaks in the text file and
look
> only at it's string/text values.
>
> Are there any memory issues I should consider if I want to read a text
file
> into a string variable?
>
> The question is should I read it into one giant string and then process
> that - or -
> should I read it into an array of strings (one string for each line in
> file). Is there a limit to the size of a string variable in vb? vba?
>
> My processing will have to look through the resultant structure (spanning
> lines of the original file) or basically ignoring the division into lines
> that the file has.
> That would possibly be an advantage in putting the whole file into one
> string- then my parsing routine doesn't need a bunch of code to jump to
next
> line (item in array) and can just move through the string start to end.
>
> any thoughts on this?
> Thanks,
> mark
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Hi Laurie,
Hows' things down under?

"Laurie Comerford" wrote in message
news:8C61F19B1EE17A48834EA0678316FDC4@in.WebX.maYIadrTaRb...
> Hi Mark,
>
> The documentation will tell you the max length of a string.
yep, found it there
There are two kinds of strings: variable-length and fixed-length strings.
A variable-length string can contain up to approximately 2 billion (2^31)
characters.
A fixed-length string can contain 1 to approximately 64K (2^16) characters.

> I would see
> advantages in putting as much in a single string as possible as you can
then
> use the "split" command to break the string down into a variant array.

I'll have to check that one out, I'm not familiar with it.

Thanks for the response

G'day
Mark
0 Likes
Message 4 of 4

Anonymous
Not applicable
Hi Mark,

Busy, busy, busy.

We are at last getting some of our software up on the web site.

Installation features seem to have taken far longer to sort out than the
programs themselves.

It would be so nice if you could give a user a program to try. He loads it,
checks the available macros, writes a menu file to call it. Runs it.
Decides he likes it so posts you the money. 🙂 real life 😞

Other than that it's about 9am, about 12 degrees C, 5% cloud cover and no
wind today in Melbourne. The beach is beautiful and I've just come back
from walking our new poodle pup.

--


Laurie Comerford
CADApps
www.cadapps.com.au


"Mark Propst" wrote in message
news:63B7907610F52D239C8CE6FF618B3C0A@in.WebX.maYIadrTaRb...
> Hi Laurie,
> Hows' things down under?
>
> "Laurie Comerford" wrote in message
> news:8C61F19B1EE17A48834EA0678316FDC4@in.WebX.maYIadrTaRb...
> > Hi Mark,
> >
> > The documentation will tell you the max length of a string.
> yep, found it there
> There are two kinds of strings: variable-length and fixed-length strings.
> A variable-length string can contain up to approximately 2 billion (2^31)
> characters.
> A fixed-length string can contain 1 to approximately 64K (2^16)
characters.
>
> > I would see
> > advantages in putting as much in a single string as possible as you can
> then
> > use the "split" command to break the string down into a variant array.
>
> I'll have to check that one out, I'm not familiar with it.
>
> Thanks for the response
>
> G'day
> Mark
>
>
0 Likes