find_from
fn find_from(Vec<byte> hay, Vec<byte> needle, int start) -> int Import
Source: use bytes::{find_from}; src/bytes.hy Returns the offset of the first needle in hay at or after start, or -1.
Parameters#
| Name | Type |
|---|---|
hay | Vec<byte> |
needle | Vec<byte> |
start | int |
Returns#
int
Contracts#
Checked according to --contracts (see Contracts).
ensures result >= -1 && result <= hay.len()
ensures result < 0 || result >= start || (start > hay.len() && result == hay.len())
ensures result < 0 || (result + needle.len() <= hay.len() && region_eq(hay, result, needle, 0, needle.len()))
See also#
region_eq: True whena[ao..ao+n)equalsb[bo..bo+n)(caller guarantees bounds).to_hex: Encodesbufas lowercase hexadecimal, two digits per byte.from_hex: Decodes hexadecimal text (either case) into bytes.slice: Returns a copy ofsrc[start..end](end exclusive), with both offsets clamped to the buffer.concat: Returns a new buffer holdingafollowed byb.eq: Returnstruewhenaandbhave the same length and the same bytes.find: Returns the offset of the firstneedleinhay, or-1.rfind: Returns the offset of the lastneedleinhay, or-1.