Skip to content

Instantly share code, notes, and snippets.

@jmjuanes
Last active October 4, 2015 11:57
Show Gist options
  • Save jmjuanes/08b693b1f2673c70e8db to your computer and use it in GitHub Desktop.
Save jmjuanes/08b693b1f2673c70e8db to your computer and use it in GitHub Desktop.
Converts a tabulated string to an array
//Number of elements of the array
const int N = 11;
//Function Tabulated String to array
void TabStringToArray(string str, string arr[])
{
//Aux vars
int pos = 0;
//Read all
for(int i = 0; i < N; i++)
{
//Find the next tab
pos = str.find("\t");
//Get the substring
arr[i] = str.substr(0, pos);
//Cut the string
str = str.substr(pos + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment