The code below does what I need it to do, but it looks like a train wreck and still adds quotation marks around the output. I would guess that the same result could be had in three to five lines and be quotation free. Do I really have to remove parenthesis and white space each time I do this? Please suggest corrections?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
NSString *key = [terms objectAtIndex:row];
NSArray *nameSection = [letters objectForKey:key];
NSString *one = @"()";
NSString *two = [NSString stringWithFormat:@"%@", nameSection];
NSString *four = [two stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:one]];
NSString *five = [four stringByTrimmingCharactersInSet: [NSCharacterSet newlineCharacterSet]];
NSString * definition = [[NSString alloc] initWithFormat:@"%@", five];
def.text = definition;
[definition release];
}
edit:
You can add
\"tooneto make the quotations disappear. And thedefinitionlines can be skipped and you can just dodef.text = five;instead.