[Last Call] Learn how to a build a cloud-first strategyRegister Now


convert string to an array java

Posted on 2007-09-28
Medium Priority
Last Modified: 2013-11-24
Convert string like "abc,etc,sdq,sds,dse" to an array of 5 strings using java?
Question by:anup001
LVL 12

Expert Comment

ID: 19982423
You need to use a StringTokenizer with a comma as the field separator.  Check it out here:

How to break a String into tokens with the StringTokenizer class
LVL 23

Accepted Solution

Ajay-Singh earned 2000 total points
ID: 19982674
Use split

String[] array = "abc,etc,sdq,sds,dse".split(",");

Author Comment

ID: 19985190
Thanks Ajay

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month17 days, 23 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question