Pregunta

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? ?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top