chickadee » srfi-207 » bytestring-prefix-length

bytestring-prefix-length bytevector₁ bytevector₂procedure
bytestring-suffix-length bytevector₁ bytevector₂procedure

Return the length of the longest common prefix/suffix of bytevector₁ and bytevector₂. For prefixes, this is equivalent to their "mismatch index".

(bytestring-prefix-length #u8"Heart Of Gold" #u8"Heart of Gold") ⇒ 6
(bytestring-suffix-length #u8"Heart Of Gold" #u8"Heart of Gold") ⇒ 6
(bytestring-prefix-length-ci #u8"Heart Of Gold" #u8"Heart of Gold") ⇒ 13

(Extension based on string-prefix-length, etc. from srfi-152.)