• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting value from Vector

 
Ranch Hand
Posts: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic