* This function locates the goal substring in the input and removes * everything before it. * stripPrefix("abcdef", "cd") -> "cdef" * stripPrefix("abcdef", "xx") -> "abcdef" */
| 73 | * stripPrefix("abcdef", "xx") -> "abcdef" |
| 74 | */ |
| 75 | std::string stripPrefix(const std::string& input, const std::string& goal) { |
| 76 | size_t loc = input.find(goal); |
| 77 | if (loc == std::string::npos) { |
| 78 | return input; |
| 79 | } else { |
| 80 | return input.substr(loc); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | std::string removeChars(const std::string& input, const std::string& chars) { |
| 85 | std::string result; |