1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-05-08 11:34:08 +02:00

[cse] new method, getUnifiedString

Enter a string list, return a string.
This commit is contained in:
Tomaz Canabrava 2017-09-14 17:23:40 +02:00 committed by Roeland Jago Douma
parent 2111aeaac1
commit 418401a33c
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 12 additions and 2 deletions

View File

@ -5,7 +5,7 @@ namespace WordList {
#include <initializer_list>
QStringList getRandomWords()
QStringList getRandomWords(int nr)
{
QStringList wordList = {
"abandon",
@ -2059,7 +2059,7 @@ QStringList getRandomWords()
};
QStringList randomWords;
while(randomWords.size() != 16) {
while(randomWords.size() != nr) {
QString currWord = wordList.at(rand());
if (!randomWords.contains(currWord)) {
randomWords.append(currWord);
@ -2068,6 +2068,15 @@ QStringList getRandomWords()
return randomWords;
}
QString getUnifiedString(const QStringList& wList)
{
QString ret;
for(const auto& str : wList) {
ret += str;
}
return ret;
}
// Namespaces
}
}

View File

@ -7,6 +7,7 @@
namespace OCC {
namespace WordList {
QStringList getRandomWords(int nr);
QString getUnifiedString(const QStringList& l);
}
}