Created
February 9, 2015 01:51
-
-
Save internetsadboy/0cbc05ac56a8bc317898 to your computer and use it in GitHub Desktop.
qm-regex
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
/** | |
* @param {String} str | |
* @return {Boolean} | |
*/ | |
function hasQuestionMark (str) { | |
return /\?/g.test(str); | |
} | |
/** | |
* @param {String} str | |
* @return {String} | |
*/ | |
function setQuestionMark (str) { | |
return str.replace(/\?{2,}/g, '?'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment