Search code examples
iosparsingnsstringstring-parsing

iOS - parse a string using whitespace


I am an iOS newbie, so please pardon me if this is a beginner level question.

I have a string "hu_HU Hungary:Hungarian" and I want to put it into an array like {"hu", "HU", "Hungary:Hungarian"}. How would I parse it to remove the whitespace and then the underscore?


Solution

  • Use componentsSeparatedByCharactersInSet: method of NSString