DevJuice: Spellchecking short strings
I’ve been working on updating my UIColor utilities as part of building a color sampling app. Stumbling across this survey, I decided to add the xkcd colors to my repository, along with code that matched colors to their nearest xkcd equivalents.
What I found is that as delightful as the sourced color descriptions are, that they were rather full of misspellings, for example “urple”.
So I put together a simple NSString category to find misspellings and “creatively” described colors. I found this approach to be useful enough that I decided to share it on a DevJuice.
Normally, you use text checkers to find misspellings in text view and fields, and to present those items to the user. But you’re certainly not limited to that scenario. This simple string category lets you test whether a misspelled word was found, enabling me to automate my inspection.
I loaded up the xkcd names as an array and searched them to find any potential errors. Out of nearly a thousand color names, it quickly flagged about two dozen issues — saving a huge amount of detail checking.
This doesn’t of course, guarantee the correctness of my results. I know I left in a few amusing misspellings: “Blurple,” for example, plus if any misspellings ended up as a legal English word, they will not have been flagged.
What’s more I had to bowdlerize some entries. Apple does not have any “offensive language” tester that I could find. (Know of one? Please ping me about it!) So I had to update those items by hand.
In any case, I hope you’ll find this useful. Happy coding!
- Download iOS 7.0.6
- How To Jailbreak iOS 7 – 7.0.6 Untethered On iPhone 5s, 5c, 5, 4s And More With Evasi0n7
- How To Downgrade iOS 7 To iOS 6.1.3 / 6.1.4
- How To Jailbreak iOS 6.1.3 On iPhone 4, iPod touch 4 and iPhone 3GS Using Redsn0w
- How To Jailbreak iOS 6.0 to 6.1.2 Untethered On iPhone 4,3GS, iPod touch 4 Using Sn0wbreeze 2.9.11
- How To Jailbreak iOS 6.1.2 Untethered On iPhone 5,4S, iPad, iPod touch Using Evasi0n 1.5
- How To Jailbreak iOS 6 With Official Cydia On iPhone 4, iPhone 3GS And iPod touch 4G Using Redsn0w 0.9.15b1