Created
June 26, 2023 04:48
-
-
Save pmatsinopoulos/7e43563ba864c8867ecc688ff74e6fea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************************************* | |
* Returns a copy of "input" without the characters that exist inside the "setOfCharacters". | |
* It does the work in a case insensitive mode. | |
* Example: "Hello World!" with "setOfCharacters" being "oe", returns "Hll Wrld!". | |
* | |
* @param input | |
* @param setOfCharacters | |
* @returns String | |
*/ | |
function squeeze(input, setOfCharacters) { | |
var re = new RegExp("[" + setOfCharacters + "]", "gi"); | |
return input.replace(re, ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment