?
Solved

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

Posted on 2009-02-09
1
Medium Priority
?
823 Views
Last Modified: 2013-11-24
Hi

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

0
Comment
Question by:techques
1 Comment
 
LVL 13

Accepted Solution

by:
Bart Cremers earned 150 total points
ID: 23590792
split returns a String array, so

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

System.our.println(s[0]);
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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.
Suggested Courses
Course of the Month16 days, 14 hours left to enroll

862 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