A typical string will look like this:
"sam,larry,bill,mary,allen,jim,fred,joe,john"
This string is correct in the sense that no names are repeated
However, on occasions, the string could look like this:
"sam,larry,bill,sam,mary,allen,sam,jim,fred,bill,joe,john"
'sam' is repeated two times and 'bill' is repeated one time . I do not know from one time to the next what names will appear in the string so I cannot check on fixed names.
Is there a simple way to detect if any name appears more than once and remove it from the string if it does?
"sam,larry,bill,mary,allen,jim,fred,joe,john"
This string is correct in the sense that no names are repeated
However, on occasions, the string could look like this:
"sam,larry,bill,sam,mary,allen,sam,jim,fred,bill,joe,john"
'sam' is repeated two times and 'bill' is repeated one time . I do not know from one time to the next what names will appear in the string so I cannot check on fixed names.
Is there a simple way to detect if any name appears more than once and remove it from the string if it does?