The first approach looks like this to me:
while(..) { Test end of string } while(..) { Your Code }
While the second approach looks like this:
while(..) { Your Code + Test end of string }
IMHO, both approaches calculate approximately the same number of operations and I consider them equivalent. In addition, strlen is quite optimized , as already mentioned, and well tested. Moreover, the second approach looks like a premature optimization :) You would better check / analyze your code if necessary, and then optimize (in the end, this is just a linear algorithm).
However, you can consider the second approach, if processing may stop long before the end of the line (for example, find the first occurrence of the word).
source share