Extract and return the string suffix for a key (which might be the empty string if there is no suffix). Returns false if the key did not match the prefix.
| 23 | // string if there is no suffix). Returns false if the key did not match |
| 24 | // the prefix. |
| 25 | bool tryGetSuffixedKey(const std::string& key, const std::string& prefix, |
| 26 | std::string& suffixedOutput) |
| 27 | { |
| 28 | if (string::istarts_with(key, prefix)) |
| 29 | { |
| 30 | suffixedOutput = key.substr(prefix.length()); |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | suffixedOutput.clear(); |
| 35 | return false; |
| 36 | } |
| 37 | |
| 38 | } // namespace |
| 39 |
no test coverage detected