Re: Reading/Writing to array
From: benben (benhongh_at_yahoo.com.au)
Date: 11/24/04
- Next message: Agoston Bejo: "variable scope"
- Previous message: benben: "preventing page from being unloaded, how??"
- In reply to: Trent: "Reading/Writing to array"
- Next in thread: Trent: "Re: Reading/Writing to array"
- Reply: Trent: "Re: Reading/Writing to array"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Nov 2004 16:24:06 +0800
Hi! I am unable to assess your problem because you have not speculated your
problem.
In your dilema section, you gave a suspection but not a problem. What is the
code like? Give us a sample or at least a hint. What is the problem like?
What did you observe? What is the incorrect output that surprised you?
So far it all sounds pretty all right to me. The String.split method does
give empty strings when encountering consecutive delimiters, and it should
bring you to what you would have expected.
As an alternative approach to delimiter, you can store each data item with
the first few characters indicating the length of the data. when you retore
the data from the text, use a loop, first read the length, then read the
subsequent text of that length, and repeat it again. But I suspect it will
only increase your work.
ben
> Hi Everyone,
> This is probably easy.
>
> My situation: I am creating an array in my application to store client
> data. I store the data in a series of 7 items in the array and sometimes
> some of the values are blank. I just set the value to "" and it works
fine.
>
> My dilema: I take that array and write it to a text file using a
character
> as a delimiter between items. When I read that text file into my script
and
> back into an array I use the split command to dump it directly into the
> array again. I suspect the problem I am having is that the split command
> sees several delimiters in a row and does not store a value where the
empty
> items were originally.
>
> Any easy way around this? Or do I have to put filler characters into my
> array and then test for them before using the data?
>
>
- Next message: Agoston Bejo: "variable scope"
- Previous message: benben: "preventing page from being unloaded, how??"
- In reply to: Trent: "Reading/Writing to array"
- Next in thread: Trent: "Re: Reading/Writing to array"
- Reply: Trent: "Re: Reading/Writing to array"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|