blob: 703db5432163729b7473df12c65bfeab6525ef01 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#pragma once
#include <util/generic/strbuf.h>
template <bool addAll, char sep, char sepKeyVal, class F>
static inline void ScanKeyValue(TStringBuf s, F&& f) {
TStringBuf key, val;
while (!s.empty()) {
val = s.NextTok(sep);
if (val.empty()) {
continue; // && case
}
key = val.NextTok(sepKeyVal);
if (addAll || val.IsInited()) {
f(key, val); // includes empty keys
}
}
}
|