pivariant, enum, tiny format
This commit is contained in:
@@ -1391,6 +1391,31 @@ PIString PIString::takeNumber() {
|
||||
}
|
||||
|
||||
|
||||
PIString PIString::takeInteger() {
|
||||
PIString ret;
|
||||
int sz = size_s(), ws = -1, we = -1;
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
PIChar c = at(i);
|
||||
if (c == ' ' || c == '\t' || c == '\n' || c == '\r') {
|
||||
if (we < 0 && ws >= 0) {
|
||||
we = i;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (ws < 0) ws = i;
|
||||
if (!c.isDigit()) {
|
||||
we = i;
|
||||
break;
|
||||
}
|
||||
if (we >= 0) break;
|
||||
}
|
||||
}
|
||||
ret = mid(ws, we - ws);
|
||||
cutLeft(we < 0 ? sz : we);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//! \~\details
|
||||
//! \~english "shield" symbol prevent analysis of the next symbol
|
||||
//! \~russian Символ "shield" экранирует следующий символ
|
||||
|
||||
@@ -806,6 +806,10 @@ public:
|
||||
//! \~english Take a number with C-format from the begin of this string and return it.
|
||||
//! \~russian Извлекает число в C-формате с начала строки и возвращает его как строку.
|
||||
PIString takeNumber();
|
||||
|
||||
//! \~english Take a digits from the begin of this string and return it.
|
||||
//! \~russian Извлекает цифры с начала строки и возвращает их как строку.
|
||||
PIString takeInteger();
|
||||
|
||||
//! \~english Take a range between "start" and "end" characters from the begin of this string and return it.
|
||||
//! \~russian Извлекает диапазон между символами "start" и "end" с начала строки и возвращает его.
|
||||
|
||||
Reference in New Issue
Block a user