• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

splitting and comparing splitted Strings

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean you want to have just one copy of each word ie remove all duplicates?
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tony Docherty for your favorable reply

Yes exactly I need this
 
Tony Docherty
Bartender
Posts: 2957
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic