2013-04-24 18 views
1

在這個問題(iPhone objective-c: detecting a 'real' word)函數返回如果字是「實字」爲什麼range.location == NSNotFound表示找到一個單詞而不是相反?

return misspelledRange.location == NSNotFound; 

我很困惑,爲什麼是這樣的下面一行是真正的「==」,而不是「!= 」。 「不等於NSNotFound」是否意味着這個詞被找到了 - 在這個回答中似乎是這樣的Can NSRange determine if a snippet of text exists in a larger string?

回答

3

如果我理解正確的話,如果給定的字有包含拼寫錯誤的詞,函數返回true,所以

return misspelledRange.location == NSNotFound; 

是有道理的。

相關問題