GeeCON Prague 2014*
The moose likes Java in General and the fly likes Getting value from Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Getting value from Vector" Watch "Getting value from Vector" New topic
Author

Getting value from Vector

Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 156

Hi All

I m using Vector that has following data

100001,450

how can i get data i.e 450 from this vactor that appear after comma.


ANAND


Love is GOD and GOD is Love.
Anand Karia
IT Concretor.......
M/s. Anand Karia Concreting IT
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Anand Karia:

100001,450

how can i get data i.e 450 from this vactor that appear after comma.


-Retrieve the whole element from the vector first.
-Use String's substring() method and indexOf() method to cut the part after the comma.

Anand, BTW, this kind of question is not that advance... Your post will sonn be moved to Java in General (beginner) or Java in General (intermediate)

Hope my suggestion helps...


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi Anand,
What data type is the object inside that vector?
If that is String, you can retrive that value like this...



Hopes this helps...
correct me if i am wrong
daniel
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

I'm moving this thread to Java In General (Intermediate) where I think its more appropriate.
Please post your replies there, Thanks!.
Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 156

Thank Fisher Daniel.

I got my required value through your suggestion. Actually was using
vc.get(0) but "," was creating problem for me.

Thanks a lot.

ANAND
 
 
subject: Getting value from Vector