How can I split "id|name|age|" in java 1.3  
Author Message
hani_alaita





PostPosted: 2003-10-17 23:03:00 Top

java-programmer, How can I split "id|name|age|" in java 1.3 How can I split "id|name|age|" in java 1.3

I had it working in java 1.4 with a split function, but I have to make
it run on Java 1.3 as well. any ideas?

Thanks
 
Michael Borgwardt





PostPosted: 2003-10-17 23:13:00 Top

java-programmer >> How can I split "id|name|age|" in java 1.3 Hani wrote:
> How can I split "id|name|age|" in java 1.3
>
> I had it working in java 1.4 with a split function, but I have to make
> it run on Java 1.3 as well. any ideas?

java.util.StringTokenizer should do.

 
VisionSet





PostPosted: 2003-10-17 23:16:00 Top

java-programmer >> How can I split "id|name|age|" in java 1.3 "Hani" <email***@***.com> wrote in message
news:email***@***.com...
> How can I split "id|name|age|" in java 1.3
>
> I had it working in java 1.4 with a split function, but I have to make
> it run on Java 1.3 as well. any ideas?
>

Use the java.util.StringTokenizer class.

new StringTokenizer("id|name|age|","|");

There is an example in the API as to how to use it.

--
Mike W


 
 
Chris Smith





PostPosted: 2003-10-18 6:13:00 Top

java-programmer >> How can I split "id|name|age|" in java 1.3 Michael Borgwardt wrote:
> Hani wrote:
> > How can I split "id|name|age|" in java 1.3
> >
> > I had it working in java 1.4 with a split function, but I have to make
> > it run on Java 1.3 as well. any ideas?
>
> java.util.StringTokenizer should do.

To head off another common question that's come up more times than days
recently, this only works if there are no empty fields. If there are
empty fields, you'll need to find a replacement (or greatly complicate
your client code). Jon Skeet's written one, and I posted a link within
the past day or so either here or in .help.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation