def str_byte_index(haystack, needle, offset = 0)

      result = nil
      mb_idx = haystack.index(needle, offset)

      unless mb_idx.nil?

        if mb_idx < 1
          result = 0
        else
          matched = haystack.slice(0..mb_idx)
          result  = matched.bytesize - matched[-1].bytesize
        end
      end

      result
    end
def str_byte_index(haystack, needle, offset = 0)

      result = nil
      mb_idx = haystack.index(needle, offset)

      unless mb_idx.nil?

        if mb_idx < 1
          result = 0
        else
          matched = haystack.slice(0..mb_idx)
          result  = matched.bytesize - matched[-1].bytesize
        end
      end

      result
    end
String#index for multibyte