convert string to an array java

Posted on 2007-09-28
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

    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

    Use split

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

    Author Comment

    Thanks Ajay

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
    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…
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now