iOS Storing, in order, text from a pdf

Ja Di ksw

macrumors 65816
Original poster
Apr 9, 2003
1,306
4
Hi everyone,
Is there a simple way to read/store the words from a pdf in order (for example, putting them in a NSMutableArray?) so each word can be retrieved later?
Thanks!
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,815
145
Novi, MI
You could read the file into an NSString and then use the NSString method "componentsSeparatedByString:"

This should help
 
Comment

Duncan C

macrumors 6502a
Jan 21, 2008
853
0
Northern Virginia
Hi everyone,
Is there a simple way to read/store the words from a pdf in order (for example, putting them in a NSMutableArray?) so each word can be retrieved later?
Thanks!
-Convert the PDF to an NSString
-Use componentsSeparatedByString to create an array of words
-Use sortedArrayUsingSelector:mad:selector(caseInsensitiveCompare) to sort the array.

You'll have tons of duplicate words. You might want to remove those. To do that you could convert the array into an NSOrderedSet or NSMutableOrderedSet and sort that.
 
Comment

Ja Di ksw

macrumors 65816
Original poster
Apr 9, 2003
1,306
4
Thanks for all the help (and sorry about my late reply, been insanely busy). I'll give it a go this week and see how it works.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.