Skip to content

Instantly share code, notes, and snippets.

@henrik-ch
Created February 26, 2012 13:32
Show Gist options
  • Save henrik-ch/1916746 to your computer and use it in GitHub Desktop.
Save henrik-ch/1916746 to your computer and use it in GitHub Desktop.
find right for google app script
// 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