0

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

Salmo
  • 1,758
  • 1
  • 17
  • 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
  • 8,826
  • 12
  • 43
  • 60