All pastes #744261 Raw Edit

Sring.Split ?

public text v1 · immutable
·published 2007-10-21 07:48 UTC
rendered paste body
// Function used to split a string based on a delimiter and push it into a vector
void split_string(string& str, string& delim, vector<double>& results){
	try{
		int i;
		while ((i = str.find_first_of(delim)) != str.npos){
			if (i > 0)
				results.push_back(string_to_double(str.substr(0,i)));
			str = str.substr(i+1);
		}
		if (str.length() > 0)
			results.push_back(string_to_double(str));
	} catch (runtime_error e){
		throw e;
	}
}