How to get first value of a String with split delimiter?

Posted on 2009-02-09
Last Modified: 2013-11-24

I have a String v = "3,6,8,10";
How can I get the value '3' and '8'?

v.split("\\,") //how to use it to get the value?

Open in new window

Question by:techques
    1 Comment
    LVL 13

    Accepted Solution

    split returns a String array, so

    String[] s = v.split("\\,");


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    wait notify demo infinite loop 3 69
    wordsWithoutList  challenge 24 62
    countX 22 53
    endX challenge 2 33
    I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    754 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

    20 Experts available now in Live!

    Get 1:1 Help Now