Forums Register Login

Getting a required value from a String

+Pie Number of slices to send: Send
Hi,

This may sound strange but I would like to know if there is a better solution for my question.

I have a String say

String abc = " India = Delhi,USA=Washington,UK=London";

I would like to get the values by specifying the country Name.If I want to get the value for India,I should get the corresponding value.I Don't want to use StringTokenizer.I want to know if there are any function in Java6 which can improve my code reading.

Thanks
Siva.
+Pie Number of slices to send: Send
Siva:

You'll be much better off splitting that String up into a Map. Maps use key, value pairs, and allow very quick searching by keys.

John.
Message for you sir! I think it is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 772 times.
Similar Threads
Prometric Centre Recommendation
How to get the form parameter in the HTML page?
Extract float value from string
How to buy scjp1.4 examination voucher in India
Cameron books query
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 02:03:20.