I have an array of strings, and need to grab substrings (the strings in between commas, in this case) and put them into another array of strings.
I declare it as strings[numberOfTapes], so when I am searching for the commas I go character by character in a nested for loop, like so:
for(int j = 0; j < tapes[i].length(); j++){
if(tapes[i][j] == ','){
input[counter2] = tapes[i][j].substr(i-counter, counter);
}
}
For which I get the following error:
request for member 'substr' in tapes[i].std::basic_string::operator[] [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocated] (((long unsigned int)))', which is of non class type 'char'
I'm going through the string character by character with j. Is there a way to get .substr to work with the tapes[i][j] format, or do I need to implement this differently to work?