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:
parent
2111aeaac1
commit
418401a33c
src/libsync
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
namespace OCC {
|
||||
namespace WordList {
|
||||
QStringList getRandomWords(int nr);
|
||||
QString getUnifiedString(const QStringList& l);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user