//
// @author      OA Wu <oawu.tw@gmail.com>
// @copyright   Copyright (c) 2015 - 2025, @oawu/scss
// @license     http://opensource.org/licenses/MIT  MIT License
// @link        https://www.ioa.tw/
//

@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;
}
