aspose file tools
The moose likes Java in General and the fly likes splitting and comparing splitted Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "splitting and comparing splitted Strings" Watch "splitting and comparing splitted Strings" New topic
Author

splitting and comparing splitted Strings

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Hello,



I am trying to read unique data by removing similar values in array after splitting it but unable to go a head. Please advise

Thanks in anticipation
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2703
    
  56
Do you mean you want to have just one copy of each word ie remove all duplicates?
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 833
Thanks Tony Docherty for your favorable reply

Yes exactly I need this
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2703
    
  56
If you don't need to maintain any ordering put all the strings into HashSet, if the order needs to be maintained use a LinkedHashSet.
You will need to trim each of the strings returned from split unless you can guarantee there are no spurious white spaces in the original string you are splitting.
 
Consider Paul's rocket mass heater.
 
subject: splitting and comparing splitted Strings
 
It's not a secret anymore!