Last active
August 29, 2015 14:24
-
-
Save rootux/5b4998cceface9f0fd54 to your computer and use it in GitHub Desktop.
Javascript Find char in string reverse from position
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
if (typeof String.prototype.findACharInStringPrev !== 'function') { | |
String.prototype.findACharInStringPrev = function(char, start) { | |
do { | |
if(this[start] == char) | |
return start; | |
start--; | |
}while(start >= 0) | |
return -1; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment