Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting value from Vector

 
Anand Karia
Ranch Hand
Posts: 156
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 156
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic