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

H

Hani

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
 
M

Michael Borgwardt

Hani said:
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.
 
V

VisionSet

Hani said:
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.
 
C

Chris Smith

Michael said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top