feat(token): Add optional suffix to label tokens

This commit is contained in:
Michael Carlberg
2016-12-04 04:03:17 +01:00
parent 70bd235e9e
commit 0cfddf7d72
5 changed files with 43 additions and 42 deletions

View File

@ -85,19 +85,6 @@ namespace string_util {
return replaced;
}
/**
* Replace all occurrences with bounded replacement
*/
string replace_all_bounded(
const string& haystack, string needle, string replacement, size_t min, size_t max, size_t start, size_t end) {
if (max != 0 && replacement.length() > max) {
replacement = replacement.erase(max);
} else if (min != 0 && replacement.length() < min) {
replacement.insert(0, min - replacement.length(), ' ');
}
return replace_all(haystack, move(needle), replacement, start, end);
}
/**
* Replace all consecutive occurrences of needle in haystack
*/