Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qstringlist.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#include <qstringlist.h>
6#if QT_CONFIG(regularexpression)
7# include <qregularexpression.h>
8#endif
9#include <private/qduplicatetracker_p.h>
10#include <QtCore/qlatin1stringmatcher.h>
11
12#include <algorithm>
14
15/*! \typedef QStringListIterator
16 \relates QStringList
17
18 The QStringListIterator type definition provides a Java-style const
19 iterator for QStringList.
20
21 QStringList provides both \l{Java-style iterators} and
22 \l{STL-style iterators}. The Java-style const iterator is simply
23 a type definition for QListIterator<QString>.
24
25 \sa QMutableStringListIterator, QStringList::const_iterator
26*/
27
28/*! \typedef QMutableStringListIterator
29 \relates QStringList
30
31 The QStringListIterator type definition provides a Java-style
32 non-const iterator for QStringList.
33
34 QStringList provides both \l{Java-style iterators} and
35 \l{STL-style iterators}. The Java-style non-const iterator is
36 simply a type definition for QMutableListIterator<QString>.
37
38 \sa QStringListIterator, QStringList::iterator
39*/
40
41/*!
42 \class QStringList
43 \inmodule QtCore
44 \brief The QStringList class provides a list of strings.
45
46 \ingroup tools
47 \ingroup shared
48 \ingroup string-processing
49
50 \reentrant
51
52 QStringList is actually just a QList<QString>. Like QList, QStringList is
53 \l{implicitly shared}. It provides fast index-based access as well as fast
54 insertions and removals. Passing string lists as value parameters is both
55 fast and safe.
56
57 All of QList's functionality also applies to QStringList. For example, you
58 can use isEmpty() to test whether the list is empty, and you can call
59 functions like append(), prepend(), insert(), replace(), removeAll(),
60 removeAt(), removeFirst(), removeLast(), and removeOne() to modify a
61 QStringList. In addition, QStringList provides a few convenience
62 functions that make handling lists of strings easier.
63
64 \section1 Initializing
65
66 The default constructor creates an empty list. You can use the
67 initializer-list constructor to create a list with elements:
68
69 \snippet qstringlist/main.cpp 0a
70
71 \section1 Adding Strings
72
73 Strings can be added to a list using the \l
74 {QList::insert()}{insert()}, \l
75 {QList::append()}{append()}, \l
76 {QList::operator+=()}{operator+=()} and \l
77 {operator<<()} functions.
78
79 \l{operator<<()} can be used to
80 conveniently add multiple elements to a list:
81
82 \snippet qstringlist/main.cpp 0b
83
84 \section1 Iterating Over the Strings
85
86 See \l {Iterating over Containers}.
87
88 \section1 Manipulating the Strings
89
90 QStringList provides several functions allowing you to manipulate
91 the contents of a list. You can concatenate all the strings in a
92 string list into a single string (with an optional separator)
93 using the join() function. For example:
94
95 \snippet qstringlist/main.cpp 4
96
97 The argument to join can be a single character or a string.
98
99 To break up a string into a string list, use the QString::split()
100 function:
101
102 \snippet qstringlist/main.cpp 6
103
104 The argument to split can be a single character, a string or a
105 QRegularExpression.
106
107 In addition, the \l {QStringList::operator+()}{operator+()}
108 function allows you to concatenate two string lists into one. To
109 sort a string list, use the sort() function.
110
111 QString list also provides the filter() function which lets you
112 to extract a new list which contains only those strings which
113 contain a particular substring (or match a particular regular
114 expression):
115
116 \snippet qstringlist/main.cpp 7
117
118 The contains() function tells you whether the list contains a
119 given string, while the indexOf() function returns the index of
120 the first occurrence of the given string. The lastIndexOf()
121 function on the other hand, returns the index of the last
122 occurrence of the string.
123
124 Finally, the replaceInStrings() function calls QString::replace()
125 on each string in the string list in turn. For example:
126
127 \snippet qstringlist/main.cpp 8
128
129 \sa QString
130*/
131
132/*!
133 \fn QStringList::QStringList(const QString &str)
134
135 Constructs a string list that contains the given string, \a
136 str. Longer lists are easily created like this:
137
138 \snippet qstringlist/main.cpp 9
139
140 \sa append()
141*/
142
143/*!
144 \fn QStringList::QStringList(const QList<QString> &other)
145
146 Constructs a copy of \a other.
147
148 This operation takes \l{constant time}, because QStringList is
149 \l{implicitly shared}. This makes returning a QStringList from a
150 function very fast. If a shared instance is modified, it will be
151 copied (copy-on-write), and that takes \l{linear time}.
152
153 \sa operator=()
154*/
155
156/*!
157 \fn QStringList::QStringList(QList<QString> &&other)
158 \overload
159 \since 5.4
160
161 Move-constructs from QList<QString>.
162
163 After a successful construction, \a other will be empty.
164*/
165
166/*!
167 \fn QStringList &QStringList::operator=(const QList<QString> &other)
168 \since 5.4
169
170 Copy assignment operator from QList<QString>. Assigns the \a other
171 list of strings to this string list.
172
173 After the operation, \a other and \c *this will be equal.
174*/
175
176/*!
177 \fn QStringList &QStringList::operator=(QList<QString> &&other)
178 \overload
179 \since 5.4
180
181 Move assignment operator from QList<QString>. Moves the \a other
182 list of strings to this string list.
183
184 After the operation, \a other will be empty.
185*/
186
187/*!
188 \fn void QStringList::sort(Qt::CaseSensitivity cs)
189
190 Sorts the list of strings in ascending order.
191
192//! [comparison-case-sensitivity]
193 If \a cs is \l Qt::CaseSensitive (the default), the string comparison
194 is case sensitive; otherwise the comparison is case insensitive.
195//! [comparison-case-sensitivity]
196
197 Sorting is performed using the STL's std::sort() algorithm,
198 which averages \l{linear-logarithmic time}, i.e. O(\e{n} log \e{n}).
199
200 If you want to sort your strings in an arbitrary order, consider
201 using the QMap class. For example, you could use a QMap<QString,
202 QString> to create a case-insensitive ordering (e.g. with the keys
203 being lower-case versions of the strings, and the values being the
204 strings), or a QMap<int, QString> to sort the strings by some
205 integer index.
206*/
207
208void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs)
209{
210 if (cs == Qt::CaseSensitive) {
211 std::sort(that->begin(), that->end());
212 } else {
213 auto CISCompare = [](const auto &s1, const auto &s2) {
214 return s1.compare(s2, Qt::CaseInsensitive) < 0;
215 };
216 std::sort(that->begin(), that->end(), CISCompare);
217 }
218}
219
220
221/*!
222 \fn QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const
223
224 Returns a list of all the strings containing the substring \a str.
225
226 \include qstringlist.cpp comparison-case-sensitivity
227
228 \snippet qstringlist/main.cpp 5
229 \snippet qstringlist/main.cpp 10
230
231 This is equivalent to
232
233 \snippet qstringlist/main.cpp 11
234 \snippet qstringlist/main.cpp 12
235
236 \sa contains()
237*/
238
239template <typename String>
240static QStringList filter_helper(const QStringList &that, const String &needle, Qt::CaseSensitivity cs)
241{
242 QStringList res;
243 for (const auto &s : that) {
244 if (s.contains(needle, cs))
245 res.append(s);
246 }
247 return res;
248}
249
250/*!
251 \fn QStringList QStringList::filter(QStringView str, Qt::CaseSensitivity cs) const
252 \overload
253 \since 5.14
254*/
255QStringList QtPrivate::QStringList_filter(const QStringList *that, QStringView str,
256 Qt::CaseSensitivity cs)
257{
258 return filter_helper(*that, str, cs);
259}
260
261/*!
262 \fn QStringList QStringList::filter(const QStringMatcher &matcher) const
263 \since 6.7
264 \overload
265
266 Returns a list of all the strings matched by \a matcher (i.e. for which
267 \c matcher.indexIn() returns an index >= 0).
268
269 Using a QStringMatcher may be faster when searching in large lists and/or
270 in lists with long strings (the best way to find out is benchmarking).
271
272 For example:
273 \snippet qstringlist/main.cpp 18
274
275 \sa contains(), filter(const QLatin1StringMatcher &)
276*/
277
278/*!
279 \fn QStringList QStringList::filter(const QLatin1StringMatcher &matcher) const
280 \since 6.9
281
282 Returns a list of all the strings matched by \a matcher (i.e. for which
283 \c matcher.indexIn() returns an index >= 0).
284
285 Using QLatin1StringMatcher may be faster when searching in large
286 lists and/or in lists with long strings (the best way to find out is
287 benchmarking).
288
289 For example:
290 \snippet qstringlist/main.cpp 19
291
292 \sa contains(), filter(const QStringMatcher &)
293*/
294QStringList QtPrivate::QStringList_filter(const QStringList &that, const QStringMatcher &matcher)
295{
296 QStringList res;
297 for (const auto &s : that) {
298 if (matcher.indexIn(s) != -1)
299 res.append(s);
300 }
301 return res;
302}
303
304QStringList QtPrivate::QStringList_filter(const QStringList &that, const QLatin1StringMatcher &matcher)
305{
306 QStringList res;
307 for (const auto &s : that) {
308 if (matcher.indexIn(s) != -1)
309 res.append(s);
310 }
311 return res;
312}
313
314/*!
315 \fn QStringList QStringList::filter(QLatin1StringView str, Qt::CaseSensitivity cs) const
316 \since 6.7
317 \overload
318*/
319
320QStringList QtPrivate::QStringList_filter(const QStringList &that, QLatin1StringView needle,
321 Qt::CaseSensitivity cs)
322{
323 return filter_helper(that, needle, cs);
324}
325
326template<typename T>
327static bool stringList_contains(const QStringList &stringList, const T &str, Qt::CaseSensitivity cs)
328{
329 for (const auto &string : stringList) {
330 if (string.size() == str.size() && string.compare(str, cs) == 0)
331 return true;
332 }
333 return false;
334}
335
336
337/*!
338 \fn bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
339
340 Returns \c true if the list contains the string \a str; otherwise
341 returns \c false.
342
343 \include qstringlist.cpp comparison-case-sensitivity
344
345 \sa indexOf(), lastIndexOf(), QString::contains()
346 */
347
348/*!
349 \fn bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const
350 \overload
351 \since 5.12
352
353 Returns \c true if the list contains the string \a str; otherwise
354 returns \c false.
355
356 \include qstringlist.cpp comparison-case-sensitivity
357 */
358bool QtPrivate::QStringList_contains(const QStringList *that, QStringView str,
359 Qt::CaseSensitivity cs)
360{
361 return stringList_contains(*that, str, cs);
362}
363
364/*!
365 \fn bool QStringList::contains(QLatin1StringView str, Qt::CaseSensitivity cs) const
366 \overload
367 \since 5.10
368
369 Returns \c true if the list contains the Latin-1 string viewed by \a str; otherwise
370 returns \c false.
371
372 \include qstringlist.cpp comparison-case-sensitivity
373
374 \sa indexOf(), lastIndexOf(), QString::contains()
375 */
376bool QtPrivate::QStringList_contains(const QStringList *that, QLatin1StringView str,
377 Qt::CaseSensitivity cs)
378{
379 return stringList_contains(*that, str, cs);
380}
381
382
383#if QT_CONFIG(regularexpression)
384/*!
385 \fn QStringList QStringList::filter(const QRegularExpression &re) const
386 \overload
387 \since 5.0
388
389 Returns a list of all the strings that match the regular
390 expression \a re.
391*/
392QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegularExpression &re)
393{
394 QStringList res;
395 for (const auto &str : *that) {
396 if (str.contains(re))
397 res.append(str);
398 }
399 return res;
400}
401#endif // QT_CONFIG(regularexpression)
402
403/*!
404 \fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
405
406 Returns a string list where every string has had the \a before
407 text replaced with the \a after text wherever the \a before text
408 is found.
409
410 \note If you use an empty \a before argument, the \a after argument will be
411 inserted \e {before and after} each character of the string.
412
413 \include qstringlist.cpp comparison-case-sensitivity
414
415 For example:
416
417 \snippet qstringlist/main.cpp 5
418 \snippet qstringlist/main.cpp 13
419
420 \sa QString::replace()
421*/
422
423/*!
424 \fn QStringList &QStringList::replaceInStrings(QStringView before, const QString &after, Qt::CaseSensitivity cs)
425 \overload
426 \since 5.14
427*/
428
429/*!
430 \fn QStringList &QStringList::replaceInStrings(const QString &before, QStringView after, Qt::CaseSensitivity cs)
431 \overload
432 \since 5.14
433*/
434
435/*!
436 \fn QStringList &QStringList::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs)
437 \overload
438 \since 5.14
439*/
440void QtPrivate::QStringList_replaceInStrings(QStringList *that, QStringView before,
441 QStringView after, Qt::CaseSensitivity cs)
442{
443 // Before potentially detaching "that" list, check if any string contains "before"
444 qsizetype i = -1;
445 for (qsizetype j = 0; j < that->size(); ++j) {
446 if (that->at(j).contains(before, cs)) {
447 i = j;
448 break;
449 }
450 }
451 if (i == -1)
452 return;
453
454 for (; i < that->size(); ++i)
455 (*that)[i].replace(before.data(), before.size(), after.data(), after.size(), cs);
456}
457
458#if QT_CONFIG(regularexpression)
459/*!
460 \fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after)
461 \overload
462 \since 5.0
463
464 Replaces every occurrence of the regular expression \a re, in each of the
465 string lists's strings, with \a after. Returns a reference to the string
466 list.
467
468 For example:
469
470 \snippet qstringlist/main.cpp 5
471 \snippet qstringlist/main.cpp 16
472
473 For regular expressions that contain capturing groups,
474 occurrences of \b{\\1}, \b{\\2}, ..., in \a after are
475 replaced with the string captured by the corresponding capturing group.
476
477 For example:
478
479 \snippet qstringlist/main.cpp 5
480 \snippet qstringlist/main.cpp 17
481*/
482void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularExpression &re,
483 const QString &after)
484{
485 // Before potentially detaching "that" list, check if any string contains "before"
486 qsizetype i = -1;
487 for (qsizetype j = 0; j < that->size(); ++j) {
488 if (that->at(j).contains(re)) {
489 i = j;
490 break;
491 }
492 }
493 if (i == -1)
494 return;
495
496 for (; i < that->size(); ++i)
497 (*that)[i].replace(re, after);
498}
499#endif // QT_CONFIG(regularexpression)
500
501static qsizetype accumulatedSize(const QStringList &list, qsizetype seplen)
502{
503 qsizetype result = 0;
504 if (!list.isEmpty()) {
505 for (const auto &e : list)
506 result += e.size() + seplen;
507 result -= seplen;
508 }
509 return result;
510}
511
512/*!
513 \fn QString QStringList::join(const QString &separator) const
514
515 Joins all the string list's strings into a single string with each
516 element separated by the given \a separator (which can be an
517 empty string).
518
519 \sa QString::split()
520*/
521
522/*!
523 \fn QString QStringList::join(QChar separator) const
524 \since 5.0
525 \overload join()
526*/
527QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, qsizetype seplen)
528{
529 const qsizetype totalLength = accumulatedSize(*that, seplen);
530 const qsizetype size = that->size();
531
532 QString res;
533 if (totalLength == 0)
534 return res;
535 res.reserve(totalLength);
536 for (qsizetype i = 0; i < size; ++i) {
537 if (i)
538 res.append(sep, seplen);
539 res += that->at(i);
540 }
541 return res;
542}
543
544/*!
545 \fn QString QStringList::join(QLatin1StringView separator) const
546 \since 5.8
547 \overload join()
548*/
549QString QtPrivate::QStringList_join(const QStringList &list, QLatin1StringView sep)
550{
551 QString result;
552 if (!list.isEmpty()) {
553 result.reserve(accumulatedSize(list, sep.size()));
554 const auto end = list.end();
555 auto it = list.begin();
556 result += *it;
557 while (++it != end) {
558 result += sep;
559 result += *it;
560 }
561 }
562 return result;
563}
564
565/*!
566 \fn QString QStringList::join(QStringView separator) const
567 \overload
568 \since 5.14
569*/
570QString QtPrivate::QStringList_join(const QStringList *that, QStringView sep)
571{
572 return QStringList_join(that, sep.data(), sep.size());
573}
574
575/*!
576 \fn QStringList QStringList::operator+(const QStringList &other) const
577
578 Returns a string list that is the concatenation of this string
579 list with the \a other string list.
580
581 \sa append()
582*/
583
584/*!
585 \fn QStringList &QStringList::operator<<(const QString &str)
586
587 Appends the given string, \a str, to this string list and returns
588 a reference to the string list.
589
590 \sa append()
591*/
592
593/*!
594 \fn QStringList &QStringList::operator<<(const QStringList &other)
595
596 \overload
597
598 Appends the \a other string list to the string list and returns a reference to
599 the latter string list.
600*/
601
602/*!
603 \fn QStringList &QStringList::operator<<(const QList<QString> &other)
604 \since 5.4
605
606 \overload
607
608 Appends the \a other string list to the string list and returns a reference to
609 the latter string list.
610*/
611
612/*!
613 \fn qsizetype QStringList::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivity cs) const
614 \fn qsizetype QStringList::indexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
615 \fn qsizetype QStringList::indexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensitivity cs) const
616
617 Returns the index position of the first match of \a str in the list,
618 searching forward from index position \a from. Returns -1 if no item
619 matched.
620
621 \include qstringlist.cpp comparison-case-sensitivity
622
623//! [overloading-base-class-methods]
624 \note The \a cs parameter was added in Qt 6.7, i.e. these methods now overload
625 the methods inherited from the base class. Prior to that these methods only
626 had two parameters. This change is source compatible and existing code should
627 continue to work.
628//! [overloading-base-class-methods]
629
630 \sa lastIndexOf()
631*/
632
633template <typename String>
634qsizetype indexOf_helper(const QStringList &that, String needle, qsizetype from,
635 Qt::CaseSensitivity cs)
636{
637 if (from < 0) // Historical behavior
638 from = qMax(from + that.size(), 0);
639
640 if (from >= that.size())
641 return -1;
642
643 for (qsizetype i = from; i < that.size(); ++i) {
644 if (needle.compare(that.at(i), cs) == 0)
645 return i;
646 }
647 return -1;
648}
649
650qsizetype QtPrivate::QStringList_indexOf(const QStringList &that, QStringView needle,
651 qsizetype from, Qt::CaseSensitivity cs)
652{
653 return indexOf_helper(that, needle, from, cs);
654}
655
656qsizetype QtPrivate::QStringList_indexOf(const QStringList &that, QLatin1StringView needle,
657 qsizetype from, Qt::CaseSensitivity cs)
658{
659 return indexOf_helper(that, needle, from, cs);
660}
661
662/*!
663 \fn qsizetype QStringList::lastIndexOf(const QString &str, qsizetype from, Qt::CaseSensitivity cs) const
664 \fn qsizetype QStringList::lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
665 \fn qsizetype QStringList::lastIndexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensitivity cs) const
666
667 Returns the index position of the last match of \a str in the list,
668 searching backward from index position \a from. If \a from is -1 (the
669 default), the search starts at the last item. Returns -1 if no item
670 matched.
671
672 \include qstringlist.cpp comparison-case-sensitivity
673
674 \include qstringlist.cpp overloading-base-class-methods
675
676 \sa indexOf()
677*/
678
679template <typename String>
680qsizetype lastIndexof_helper(const QStringList &that, String needle, qsizetype from,
681 Qt::CaseSensitivity cs)
682{
683 if (from < 0)
684 from += that.size();
685 else if (from >= that.size())
686 from = that.size() - 1;
687
688 for (qsizetype i = from; i >= 0; --i) {
689 if (needle.compare(that.at(i), cs) == 0)
690 return i;
691 }
692
693 return -1;
694}
695
696qsizetype QtPrivate::QStringList_lastIndexOf(const QStringList &that, QLatin1StringView needle,
697 qsizetype from, Qt::CaseSensitivity cs)
698{
699 return lastIndexof_helper(that, needle, from, cs);
700}
701
702qsizetype QtPrivate::QStringList_lastIndexOf(const QStringList &that, QStringView needle,
703 qsizetype from, Qt::CaseSensitivity cs)
704{
705 return lastIndexof_helper(that, needle, from, cs);
706}
707
708#if QT_CONFIG(regularexpression)
709/*!
710 \fn qsizetype QStringList::indexOf(const QRegularExpression &re, qsizetype from) const
711 \overload
712 \since 5.0
713
714 Returns the index position of the first exact match of \a re in
715 the list, searching forward from index position \a from. Returns
716 -1 if no item matched.
717
718 \sa lastIndexOf()
719*/
720qsizetype QtPrivate::QStringList_indexOf(const QStringList *that, const QRegularExpression &re, qsizetype from)
721{
722 if (from < 0)
723 from = qMax(from + that->size(), qsizetype(0));
724
725 QString exactPattern = QRegularExpression::anchoredPattern(re.pattern());
726 QRegularExpression exactRe(exactPattern, re.patternOptions());
727
728 for (qsizetype i = from; i < that->size(); ++i) {
729 QRegularExpressionMatch m = exactRe.match(that->at(i));
730 if (m.hasMatch())
731 return i;
732 }
733 return -1;
734}
735
736/*!
737 \fn qsizetype QStringList::lastIndexOf(const QRegularExpression &re, qsizetype from) const
738 \overload
739 \since 5.0
740
741 Returns the index position of the last exact match of \a re in
742 the list, searching backward from index position \a from. If \a
743 from is -1 (the default), the search starts at the last item.
744 Returns -1 if no item matched.
745
746 \sa indexOf()
747*/
748qsizetype QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, qsizetype from)
749{
750 if (from < 0)
751 from += that->size();
752 else if (from >= that->size())
753 from = that->size() - 1;
754
755 QString exactPattern = QRegularExpression::anchoredPattern(re.pattern());
756 QRegularExpression exactRe(exactPattern, re.patternOptions());
757
758 for (qsizetype i = from; i >= 0; --i) {
759 QRegularExpressionMatch m = exactRe.match(that->at(i));
760 if (m.hasMatch())
761 return i;
762 }
763 return -1;
764}
765#endif // QT_CONFIG(regularexpression)
766
767/*!
768 \fn qsizetype QStringList::removeDuplicates()
769
770 \since 4.5
771
772 This function removes duplicate entries from a list.
773 The entries do not have to be sorted. They will retain their
774 original order.
775
776 Returns the number of removed entries.
777*/
778qsizetype QtPrivate::QStringList_removeDuplicates(QStringList *that)
779{
780 QDuplicateTracker<QString> seen(that->size());
781 return that->removeIf([&](const QString &s) { return seen.hasSeen(s); });
782}
783
784QT_END_NAMESPACE
QT_BEGIN_NAMESPACEQStringListIterator
The QStringListIterator type definition provides a Java-style const iterator for QStringList.
qsizetype indexOf_helper(const QStringList &that, String needle, qsizetype from, Qt::CaseSensitivity cs)
static QStringList filter_helper(const QStringList &that, const String &needle, Qt::CaseSensitivity cs)
qsizetype lastIndexof_helper(const QStringList &that, String needle, qsizetype from, Qt::CaseSensitivity cs)
static bool stringList_contains(const QStringList &stringList, const T &str, Qt::CaseSensitivity cs)
static qsizetype accumulatedSize(const QStringList &list, qsizetype seplen)