I have this string: "str is {( You, Me )}"
Looking on SO, I found this post and this one (among others)
I want to remove the leading {( and the trailing )}
Every solution so far has been met with an error:
-[__NSCFSet length]: unrecognized selector sent to instance
or a similar variant. I can print the value to the console and I can use the unfiltered "peopleExport" elsewhere in my app.
The code I've tried so far includes :
NSString *str = (NSString *)[managedObject valueForKeyPath:@"people.name"];
NSLog(@"str is %@", str);
//NSString *string = @"hello one two three";
//NSString *newStr = [str substringFromIndex:3];
str = [str substringWithRange:NSMakeRange(2, str.length-2)];
NSString *newStr;
if ( [str length] > 0){
NSLog(@"a");
newStr = [str substringFromIndex:2];
} else {
NSLog(@"b");
newStr = str;
}
NSLog(@"%@", newStr);
peopleExport = newStr;
The source is from a core data store. Does that matter?
I would appreciate any pointers.