def const pure commonPrefix(a: text, b: text): number
Returns the number of characters that appear, identical, at the start of both a and b. It is the length of the longest text common such that startsWith(a, common) and startsWith(b, common).
Example
const A1 = commonPrefix("ABCD", "ABEF")
// A1 is 2, the prefix is "AB"
const A2 = commonPrefix("abcd", "ABCD")
// A2 is 0, the prefix comparison is case sensitive
const A3 = commonPrefix("ABCD", "ABC")
// A3 is 3, the prefix is "ABC"
Remarks
You can retrieve the common prefix (and not just its length) using substr(a, 0, startsWith(a, b)).