-1

I have some NSString object, for example:

NSString *inputString1 = @"Name is \"Mark\"";
NSString *inputString2 = @"Name is \"Joe\"";

I need to extract Mark and Joe values substrings from input.

Are there any solutions?

Thank you, in advance.

B.S.
  • 21,660
  • 14
  • 87
  • 109

2 Answers2

2
NSString *firstName = 
[[inputString1 componentsSeparatedByString:@"\""] objectAtIndex:1];
Mundi
  • 79,884
  • 17
  • 117
  • 140
1
NSString *name = [[inputString  componentsSeparatedByString:@" "] lastObject];
name = [name stringByReplacingOccurencesOfString:@"\"" withString:@""];
Saurabh Passolia
  • 8,099
  • 1
  • 26
  • 41