Skip to content

Instantly share code, notes, and snippets.

@dnorton
Created December 14, 2016 02:21
Show Gist options
  • Save dnorton/c7c637ad8da67f622eb76f8f6e47ca95 to your computer and use it in GitHub Desktop.
Save dnorton/c7c637ad8da67f622eb76f8f6e47ca95 to your computer and use it in GitHub Desktop.
def dedupe(original):
"""method to remove unnecessary ; and duplicate values"""
value_set = set(filter(bool, map(lambda it: it.strip(), original.split(';'))))
return '; '.join(list(value_set))
@hculpan
Copy link

hculpan commented Jan 24, 2020

Actually it would have been 1 line in Java, very similar to what you have here, using the functional features of Java.

@dnorton
Copy link
Author

dnorton commented Jan 27, 2020

Let's see that line!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment