Skip to content

Instantly share code, notes, and snippets.

@lunelson
Created October 17, 2015 19:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunelson/cff721c3ca3bd9c96177 to your computer and use it in GitHub Desktop.
Save lunelson/cff721c3ca3bd9c96177 to your computer and use it in GitHub Desktop.
@function str-last-index($string, $substr) {
$index: null;
$length: str-length($string);
@for $n from $length through 1 {
$index: str-index(str-slice($string, $n, $length), $substr);
@if $index { @return $index + $n - 1; }
}
@return $index;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment