Skip to content

Instantly share code, notes, and snippets.

@Daniel-Wiedemann
Created September 24, 2015 19:32
Show Gist options
  • Save Daniel-Wiedemann/fc7a4dce799649a628fe to your computer and use it in GitHub Desktop.
Save Daniel-Wiedemann/fc7a4dce799649a628fe to your computer and use it in GitHub Desktop.
Remove double Charaters (Beware of the spaces!!!)
function removeDoubleChars(){
var input = document.getElementById('inputText').value,
output = document.getElementById('outputText'),
chars = [];
for(var i = 0; i < input.length; i++){
if(chars.indexOf(input[i]) === -1) chars.push(input[i]);
}
chars.sort();
output.value = chars.join('');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment