mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2025-05-31 07:34:09 +02:00
[cse] new method, getUnifiedString
Enter a string list, return a string.
This commit is contained in:
parent
2111aeaac1
commit
418401a33c
src/libsync
@ -5,7 +5,7 @@ namespace WordList {
|
|||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
QStringList getRandomWords()
|
QStringList getRandomWords(int nr)
|
||||||
{
|
{
|
||||||
QStringList wordList = {
|
QStringList wordList = {
|
||||||
"abandon",
|
"abandon",
|
||||||
@ -2059,7 +2059,7 @@ QStringList getRandomWords()
|
|||||||
};
|
};
|
||||||
|
|
||||||
QStringList randomWords;
|
QStringList randomWords;
|
||||||
while(randomWords.size() != 16) {
|
while(randomWords.size() != nr) {
|
||||||
QString currWord = wordList.at(rand());
|
QString currWord = wordList.at(rand());
|
||||||
if (!randomWords.contains(currWord)) {
|
if (!randomWords.contains(currWord)) {
|
||||||
randomWords.append(currWord);
|
randomWords.append(currWord);
|
||||||
@ -2068,6 +2068,15 @@ QStringList getRandomWords()
|
|||||||
return randomWords;
|
return randomWords;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getUnifiedString(const QStringList& wList)
|
||||||
|
{
|
||||||
|
QString ret;
|
||||||
|
for(const auto& str : wList) {
|
||||||
|
ret += str;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// Namespaces
|
// Namespaces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
namespace OCC {
|
namespace OCC {
|
||||||
namespace WordList {
|
namespace WordList {
|
||||||
QStringList getRandomWords(int nr);
|
QStringList getRandomWords(int nr);
|
||||||
|
QString getUnifiedString(const QStringList& l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user