MCPcopy Create free account
hub / github.com/davy7125/polyphone / commonPart

Method commonPart

sources/core/utils.cpp:136–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136QString Utils::commonPart(QStringList list)
137{
138 if (list.empty())
139 return "";
140
141 QString commonPart = removeSuffix(list.takeFirst());
142 while (!list.empty())
143 {
144 QString otherStr = removeSuffix(list.takeFirst());
145
146 int sameCharNumber = 0;
147 while (sameCharNumber < commonPart.length() && sameCharNumber < otherStr.length() && commonPart[sameCharNumber] == otherStr[sameCharNumber])
148 sameCharNumber++;
149 commonPart = commonPart.left(sameCharNumber);
150 }
151
152 // Remove the extra "-" or spaces at the end and return the result
153 commonPart = commonPart.trimmed();
154 if (commonPart.endsWith("-"))
155 commonPart = commonPart.left(commonPart.length() - 1);
156 return commonPart.trimmed();
157}
158
159QString Utils::rsaEncrypt(QString input)
160{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected