2

I would like to remove the brackets and quotes when it displays in textfield. I am using NSPredicate to get the contents that I want.

Here is my code:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"Block == '1234'"];
NSArray *predicateArray = [blockStage filteredArrayUsingPredicate:predicate];
predicateStreetName = [predicateArray valueForKey:@"Street Name"];
streetName.text = [NSString stringWithFormat:@"%@", predicateStreetName];

Here is how it displays in the textfield:

(
    "Street Name Value"
)

This code displays the street name value that I want, but however, it displays with the brackets and quotes. How do I remove them?

Thank you in advance!!

Winona
  • 2,950
  • 2
  • 21
  • 29

1 Answers1

2

take a look at this Convert NSArray to NSString in Objective-C this answer Convert NSArray to NSString in Objective-C, the ' componentsJoinedByString:@"" ' will help solve your problem. Do it here:

streetName.text = [[NSString stringWithFormat:@"%@", predicateStreetName] componentsJoinedByString:@""];

kuddos, aimzy :)

Community
  • 1
  • 1
aimzy
  • 184
  • 2
  • 9