Split function

Hi,

I am having an issue with the split function.

I am using it on a CVS data dump.. but when my datadumb has a blank element (its recorded ,,), split messes up and returns a , instead of a null..

any idea on how to make split() work? My first thought was to just regEx it.. but I think a regEx would have the same problem as split...

[359 byte] By [TunaBooa] at [2007-11-27 9:22:44]
# 1
split uses regex. 1) What does your code look like?2) Can you check for an empty string prior to calling split?
petes1234a at 2007-7-12 22:17:23 > top of Java-index,Java Essentials,Java Programming...
# 2
Ah think I see the real problem.. some of the CSV data has commas in the datafield.Who would put commas in a csv datadump.argh looks like I have to do this differentlyMessage was edited by: TunaBoo
TunaBooa at 2007-7-12 22:17:23 > top of Java-index,Java Essentials,Java Programming...
# 3

> Ah think I see the real problem.. some of the CSV data has commas in the

> datafield.

Commas are OK provided you put quotes around the data value. Like this:

?nbsp;?nbsp; foo, "$1,000", over priced

They will mess up the parsing however - as you've found. You might want to check out http://ostermiller.org/utils/CSV.html where there are some utilities for reading and writing data in this format.

pbrockway2a at 2007-7-12 22:17:23 > top of Java-index,Java Essentials,Java Programming...
# 4
Yah I can look into that.. for now I took the excell version (data was in 2 flavors), and exported it as a ## separated document.. no ## in the file.. so it worked ;P
TunaBooa at 2007-7-12 22:17:23 > top of Java-index,Java Essentials,Java Programming...