@use 'sass:list'
@use 'sass:string'

@function str-replace($string, $search, $replace: '')
  $index: string.index($string, $search)

  @if $index
    $start: string.slice($string, 1, $index - 1)
    $end: str-replace(string.slice($string, $index + string.length($search)), $search, $replace)
    @return $start + $replace + $end

  @return $string

@function str-fr($selector, $name, $i: '')
  @return str-replace(str-replace($selector, '<name>', $name), '<i>', $i)

@function str-fe($selector, $name, $noProc, $i: '')
  @if $noProc
    @return str-fr($selector, $name, $i)
  @return list.join(str-fr($selector, '', $i), str-fr($selector, $name, $i), $separator: comma)
