findStrLen
By Gabriel Staples (http://electricrcaircraftguy.blogspot.com/)
28 Feb. 2015

//Find the length of a char[] C-style string, COUNTING the null terminator at the end of the string too!
//...therefore, this function will only return a value 1 or greater, since if it immediately finds the null terminator it will simply stop and return 1.
unsigned int findStrLen(char* s)
{
  unsigned int i = 0;
  byte b;
  do
  {
    b = s[i];
    i++;
  }
  while (b != 0); //keep going until null terminator found at end of string
  return i;    
}

Share