commonPrefixLength returns the length of the common prefix of two rune slices.
(text1, text2 []rune)
| 435 | |
| 436 | // commonPrefixLength returns the length of the common prefix of two rune slices. |
| 437 | func commonPrefixLength(text1, text2 []rune) int { |
| 438 | // Linear search. See comment in commonSuffixLength. |
| 439 | n := 0 |
| 440 | for ; n < len(text1) && n < len(text2); n++ { |
| 441 | if text1[n] != text2[n] { |
| 442 | return n |
| 443 | } |
| 444 | } |
| 445 | return n |
| 446 | } |
| 447 | |
| 448 | // commonSuffixLength returns the length of the common suffix of two rune slices. |
| 449 | func commonSuffixLength(text1, text2 []rune) int { |
no outgoing calls