File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Splitting a string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitting a string" Watch "Splitting a string" New topic
Author

Splitting a string

Ben Roy
Ranch Hand

Joined: Nov 01, 2000
Posts: 70
I was just posting a question regarding the java.lang.String.split() method when I figured out that I was using 1.3 and it's only available in 1.4. So that leaves me the question of whether there is some way to do this (split a comma separated list into an array) in 1.3 other than manually write my own function to do it. Anyone got a quick solution?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Ben
You'll want to check out the StringTokenizer class. It'll give you an enumeration that you can iterate over and store into an array.
There may be another way out there but this was the first that came to mind.
hope that helps


------------------
Dave
Sun Certified Programmer for the Java� 2 Platform


Dave
deadsea
Greenhorn

Joined: Nov 20, 2001
Posts: 2
Try the split function that is found in this class: http://ostermiller.org/utils/StringHelper.html
Ben Roy
Ranch Hand

Joined: Nov 01, 2000
Posts: 70
You know it's kind of funny how sometimes the problem isn't the language...
One method was reading a recordset and dumping the information in a string, then the other was converting from a string to array. Duh...I hadn't even written the first yet, so I just rethought it and made it return String[] instead. Solved all my conversion problems and works great. Thanks for the suggestions though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitting a string
 
Similar Threads
Does j2ee 1.3 with j2se 1.4 work OK?
configure java version 1.3 should be used in a jre 1.5
How to open a Maximised Window (urgent)
It runs on appletviewer but not on applet
%JavaHome%/jre/lib/ext (JDK) and Javasoft/jre/lib/ext (JRE)?