Solution using Regular Expressions:
#include <iostream>
#include <regex>
std::string line = "{10}{20}Hello World!";
// Regular expression, that contains 3 match groups: int, int, and anything
std::regex matcher("\\{(\\d+)\\}\\{(\\d+)\\}(.+)");
std::smatch match;
if (!std::regex_search(line, match, matcher)) {
throw std::runtime_error("Failed to match expected format.");
}
int start = std::stoi(match[1]);
int end = std::stoi(match[2]);
std::string text = match[3];