def find.from

bend-kit-bytes@0.3.3.0 · bytes.bend:455

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

455# Index of the first match of needle (a byte string) at or after start, or None.
456# An empty needle matches at start when start <= len.
457def find.from(b: Bytes, +needle: String, +start: U32) -> Bytes & Maybe<&2, U32>:
458  Bytes{+len, buf} = b
459  +m = count(needle, 0)
460  find.at(Bool.or(U32.is_lt(len, m), U32.is_lt((len - m : U32), start)), len, buf, needle, start, (len - m - start : U32), True{})

Uses (11)

Used by (7)