0

I need get all the words of a UITextView of individual form. In an array for example.

Salmo
  • 1,788
  • 1
  • 18
  • 29

1 Answers1

2

Simple.. Just use this if you have one space between two words:

NSArray *words = [textview.text componentsSeparatedByString:@" "];

OR if there is the possibility of multiple spaces between words:

NSArray *words = [textview.text componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]
Salman Zaidi
  • 9,342
  • 12
  • 44
  • 61