collections - how to remove commas from list of string values and get unique values from list -


i have list of string values. want remove duplicates it.

list<string> numbers = form.getvalues(); set<string> hs = new hashset<string>(); hs.addall(numbers ); numbers .clear(); numbers .addall(hs);  //number values -> 12342,12342, 23434,23434 

i unable unique values after converting set because has comma separated values.

it great know in first line in code. have 1 string values , comma or few strings in number list. in first case have split long string. otherwise work 1 element list ... replace first line with:

list<string> numbers = form.getvalues().split(","); 

Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

php - Mongodb connectivity error -