I had to write some code like this before and found a question on Stack Overflow for splitting a string by delimiter. Here's the original question: linklink.
You could use this with std::stoi for building the vector.
std::vector<int> split(const std::string &s, char delim) { std::vector<int> elems; std::stringstream ss(s); std::string number; while(std::getline(ss, number, delim)) { elems.push_back(std::stoi(number)); } return elems; } // use with: const std::string numbers("102:330:3133:76531:451:000:12:44412"); std::vector<int> numbers = split(numbers, ':');