title: How to find the amount of \n in an arduino String
body: <p>I'm trying to find the indexes of \n in a string on my arduino. This is the code i'm using:</p>
  
  <pre><code>String string = data;
  int del;
  int count = 0;
  while(true){
    if(string.indexOf("\n", (del + 1)) == -1){
      break;
      }
    else{
      del = string.indexOf("\n", (del + 1));
      count++;
      }
    }
  </code></pre>
  
  <p>For whatever reason, it's just returning 0 no matter what. My goal would be for the count variable to contain the amount of lines contained in the variable. Any advice would be great.  </p>