Question

I'm making a word game, and storing the words in a plist that I'm editing manually.

It now contains more than 600 words. When I write in new ones I'm always concerned, that the words already exist. I always have to search before I type a new one in, and this is really slows down the whole process.

Is there any way that I can check the list for duplication when I type in immediately, or check the whole plist for duplication and delete the duplicated words?

Was it helpful?

Solution

Make yourself a helper tool.

The tool will read in the array of strings from the plist and convert it to a set. Then it will accept new strings as input, adding them to the set. Duplicates simply won't be added. Convert the set back to an array before writing the file out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top