commonPrefixLength
lib.strings.commonPrefixLength
Docs pulled from | This Revision | about 1 hour ago
Returns the length of the prefix that appears in both strings a
and b
.
Inputs
a
- 1. Function argument
b
- 2. Function argument
Type
commonPrefixLength :: string -> string -> int
Noogle detected
Implementation
The following is the current implementation of this function.
commonPrefixLength = a: b:
let
m = lib.min (stringLength a) (stringLength b);
go = i: if i >= m then m else if substring i 1 a == substring i 1 b then go (i + 1) else i;
in go 0;