MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / commonPrefix

Function commonPrefix

src/plugins/git/utils/differ.cpp:12–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include <QStringList>
11
12static int commonPrefix(const QString &text1, const QString &text2)
13{
14 int i = 0;
15 const int text1Count = text1.size();
16 const int text2Count = text2.size();
17 const int maxCount = qMin(text1Count, text2Count);
18 while (i < maxCount) {
19 if (text1.at(i) != text2.at(i))
20 break;
21 i++;
22 }
23 return i;
24}
25
26static int commonSuffix(const QString &text1, const QString &text2)
27{

Callers 2

preprocess1AndDiffMethod · 0.85
mergeMethod · 0.85

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected