1

In this question (iPhone objective-c: detecting a 'real' word) the function returns the following line as true if the word is a 'real word'

return misspelledRange.location == NSNotFound;

I'm confused as to why this is "==" and not "!=". Wouldn't it make sense that "not equal to NSNotFound" would mean that the word was found -- as seems to be the case in this answer Can NSRange determine if a snippet of text exists in a larger string? ?

Community
  • 1
  • 1
mhkeller
  • 713
  • 1
  • 8
  • 19

1 Answers1

3

If I understand it correctly, that function returns true if the given word does not contain a misspelled word, so

return misspelledRange.location == NSNotFound;

makes sense.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382