|
a/src/smallut.cpp |
|
b/src/smallut.cpp |
|
... |
|
... |
475 |
}
|
475 |
}
|
476 |
s.replace(0, pos, string());
|
476 |
s.replace(0, pos, string());
|
477 |
}
|
477 |
}
|
478 |
|
478 |
|
479 |
// Remove some chars and replace them with spaces
|
479 |
// Remove some chars and replace them with spaces
|
480 |
string neutchars(const string& str, const string& chars)
|
480 |
string neutchars(const string& str, const string& chars, char rep)
|
481 |
{
|
481 |
{
|
482 |
string out;
|
482 |
string out;
|
483 |
neutchars(str, out, chars);
|
483 |
neutchars(str, out, chars, rep);
|
484 |
return out;
|
484 |
return out;
|
485 |
}
|
485 |
}
|
486 |
void neutchars(const string& str, string& out, const string& chars)
|
486 |
void neutchars(const string& str, string& out, const string& chars, char rep)
|
487 |
{
|
487 |
{
|
488 |
string::size_type startPos, pos;
|
488 |
string::size_type startPos, pos;
|
489 |
|
489 |
|
490 |
for (pos = 0;;) {
|
490 |
for (pos = 0;;) {
|
491 |
// Skip initial chars, break if this eats all.
|
491 |
// Skip initial chars, break if this eats all.
|
|
... |
|
... |
496 |
pos = str.find_first_of(chars, startPos);
|
496 |
pos = str.find_first_of(chars, startPos);
|
497 |
// Add token to the output. Note: token cant be empty here
|
497 |
// Add token to the output. Note: token cant be empty here
|
498 |
if (pos == string::npos) {
|
498 |
if (pos == string::npos) {
|
499 |
out += str.substr(startPos);
|
499 |
out += str.substr(startPos);
|
500 |
} else {
|
500 |
} else {
|
501 |
out += str.substr(startPos, pos - startPos) + " ";
|
501 |
out += str.substr(startPos, pos - startPos) + rep;
|
502 |
}
|
502 |
}
|
503 |
}
|
503 |
}
|
504 |
}
|
504 |
}
|
505 |
|
505 |
|
506 |
|
506 |
|
|
... |
|
... |
1235 |
|
1235 |
|
1236 |
class SimpleRegexp::Internal {
|
1236 |
class SimpleRegexp::Internal {
|
1237 |
public:
|
1237 |
public:
|
1238 |
Internal(const string& exp, int flags, int nm)
|
1238 |
Internal(const string& exp, int flags, int nm)
|
1239 |
: expr(exp,
|
1239 |
: expr(exp,
|
1240 |
basic_regex<char>::flag_type(regex_constants::extended |
|
1240 |
basic_regex<char>::flag_type(
|
|
|
1241 |
regex_constants::extended |
|
1241 |
((flags&SRE_ICASE) ? regex_constants::icase : 0) |
|
1242 |
((flags&SRE_ICASE) ? int(regex_constants::icase) : 0) |
|
1242 |
((flags&SRE_NOSUB) ? regex_constants::nosubs : 0)
|
1243 |
((flags&SRE_NOSUB) ? int(regex_constants::nosubs) : 0)
|
1243 |
)), ok(true), nmatch(nm) {
|
1244 |
)), ok(true), nmatch(nm) {
|
1244 |
}
|
1245 |
}
|
1245 |
std::regex expr;
|
1246 |
std::regex expr;
|
1246 |
std::smatch res;
|
1247 |
std::smatch res;
|
1247 |
bool ok;
|
1248 |
bool ok;
|