Use one common repeatCount() function in QLocale and QDateTimeParser
Change-Id: I4b6554966c4eb2c82f406a17d686982a38610b8c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
93047c71e8
commit
10e9687159
@ -11,6 +11,7 @@
|
|||||||
#include "qset.h"
|
#include "qset.h"
|
||||||
#include "qtimezone.h"
|
#include "qtimezone.h"
|
||||||
#include "qvarlengtharray.h"
|
#include "qvarlengtharray.h"
|
||||||
|
#include "private/qlocale_p.h"
|
||||||
|
|
||||||
#include "private/qstringiterator_p.h"
|
#include "private/qstringiterator_p.h"
|
||||||
#include "private/qtenvironmentvariables_p.h"
|
#include "private/qtenvironmentvariables_p.h"
|
||||||
@ -398,14 +399,10 @@ static QString unquote(QStringView str)
|
|||||||
static inline int countRepeat(QStringView str, int index, int maxCount)
|
static inline int countRepeat(QStringView str, int index, int maxCount)
|
||||||
{
|
{
|
||||||
str = str.sliced(index);
|
str = str.sliced(index);
|
||||||
if (maxCount > str.size())
|
if (maxCount < str.size())
|
||||||
maxCount = str.size();
|
str = str.first(maxCount);
|
||||||
|
|
||||||
const QChar ch(str[0]);
|
return qt_repeatCount(str);
|
||||||
int count = 1;
|
|
||||||
while (count < maxCount && str[count] == ch)
|
|
||||||
++count;
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void appendSeparator(QStringList *list, QStringView string,
|
static inline void appendSeparator(QStringList *list, QStringView string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user