Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created February 13, 2010 23:13
Show Gist options
  • Save paulirish/303720 to your computer and use it in GitHub Desktop.
Save paulirish/303720 to your computer and use it in GitHub Desktop.
// uniqueifying strings
arr = 'group1,group2,group1,group4'.split(',');
$.map(arr, function(v,i){ return $.inArray(v,arr)!=i ? null : v });
// w regex
'group1,group2,group1,group4'.replace(/((^|,)([^,]+).*),\3(?=,|$)/g, '$1')
/by temp01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment