Return the last occurence of self in b, or -1 if not found

Property definitions

core $ BytePattern :: last_index_in_from
	# Return the last occurence of `self` in `b`, or -1 if not found
	fun last_index_in_from(b: SequenceRead[Int], from: Int): Int is abstract
lib/core/bytes.nit:33,2--34,73

core :: bytes $ Int :: last_index_in_from
	redef fun last_index_in_from(b, from) do
		for i in [0 .. from].step(-1) do if b[i] == self then return i
		return -1
	end
lib/core/bytes.nit:113,2--116,4

core $ Bytes :: last_index_in_from
	redef fun last_index_in_from(b, from) do
		if is_empty then return -1
		var lst = self[length - 1]
		var bpos = lst.last_index_in_from(b, from)
		for i in [0 .. length[.step(-1) do
			if self[i] != b[bpos] then return last_index_in_from(b, bpos - 1)
			bpos -= 1
		end
		return bpos
	end
lib/core/bytes.nit:631,2--640,4