Skip to content

Instantly share code, notes, and snippets.

@rootux
Last active August 29, 2015 14:24
Show Gist options
  • Save rootux/5b4998cceface9f0fd54 to your computer and use it in GitHub Desktop.
Save rootux/5b4998cceface9f0fd54 to your computer and use it in GitHub Desktop.
Javascript Find char in string reverse from position
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