Created
February 26, 2012 13:32
-
-
Save henrik-ch/1916746 to your computer and use it in GitHub Desktop.
find right for google app script
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
// inspired by Chris Rae's VBA site: http://chrisrae.com/vba/ | |
function findRight(findIn, findWhat) { | |
var findLoc=0; | |
for(findLoc=(findIn.length - findWhat.length + 1);findLoc>=1;findLoc--) | |
{ | |
if (findIn.substring(findLoc,(findLoc + findWhat.length)) === findWhat) {return findLoc;} | |
} | |
return -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment