| 706 | */ |
| 707 | public: |
| 708 | static ssize_t diff_commonPrefix(const string_t &text1, const string_t &text2) { |
| 709 | // Performance analysis: http://neil.fraser.name/news/2007/10/09/ |
| 710 | const ssize_t n = std::min(text1.length(), text2.length()); |
| 711 | for (ssize_t i = 0; i < n; i++) { |
| 712 | if (text1[i] != text2[i]) { |
| 713 | return i; |
| 714 | } |
| 715 | } |
| 716 | return n; |
| 717 | } |
| 718 | |
| 719 | /** |
| 720 | * Determine the common suffix of two strings. |