rangeOfMisspelledWordInString find random letters as valid word

后端 未结 2 828
迷失自我
迷失自我 2020-12-22 05:53

Can anybody duplicate this result? I\'m testing rangeOfMisspelledWordInString (in iOS) to find mispelled words and some random letters return a va

相关标签:
2条回答
  • 2020-12-22 06:33

    Yes, I can reproduce it, and I would call this a bug. If I put in your test word, @"lhpcjeuw", it treats it as a valid word. But, if I use @"lahpcjeuw" (added an "a" in second position), it catches it. I noticed the same thing Tim did -- when writing this answer, the spell checker underlined that second one but not the first as I typed.

    0 讨论(0)
  • 2020-12-22 06:47

    I think "the" and "thy" just might be valid words ;)

    Other than that, my best guess is that the text system can't provide a guess for the word, and so ignores it entirely - the semantic meaning of "misspelled word" might not include "strings of letters which cannot conceivably be a misspelling of a word." I notice that when I type those strings into a system text field (e.g. in Messages), I don't get any replacement suggestions.

    You could also make sure that your UITextChecker instance isn't set to ignore those particular words; take a look at the ignoredWords property.

    0 讨论(0)
提交回复
热议问题