I'm developing in Java, I have the following string:
String duplicates = "Smith, John - Smith, John - Smith, John – Wilson, Peter";
I need to get a new string with no duplicate names.
unique = "Smith, John – Wilson, Peter";
I thought I could use
String unique[] = duplicates.split("-");
Problem with splitting hyphens with commas is that now I have all commas
Smith, John, Smith, John, Smith, John, Wilson, Peter
Any help will be greatly appreciated