File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Getting a required value from a String 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 a required value from a String" Watch "Getting a required value from a String" New topic
Author

Getting a required value from a String

sivaprasad pasupulathi
Ranch Hand

Joined: Apr 21, 2009
Posts: 36
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.
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting a required value from a String