Using string functions (.substr) on arrays of strings
<p>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. </p>

<p>I declare it as <code>strings[numberOfTapes]</code>, so when I am searching for the commas I go character by character in a nested for loop, like so:</p>

<pre><code>for(int j = 0; j &lt; tapes[i].length(); j++){
   if(tapes[i][j] == ','){
      input[counter2] = tapes[i][j].substr(i-counter, counter);
   }
}
</code></pre>

<p>For which I get the following error:</p>

<pre>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'</pre>

<p>I'm going through the string character by character with <code>j</code>. Is there a way to get <code>.substr</code> to work with the <code>tapes[i][j]</code> format, or do I need to implement this differently to work?</p>
