Last active
October 4, 2015 11:57
-
-
Save jmjuanes/08b693b1f2673c70e8db to your computer and use it in GitHub Desktop.
Converts a tabulated string to an array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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