How to parse boolean into NSString

boolean, nsstring, objective-c

Solution

Boolean is basically an integer, so you can use `%i` to get its decimal representation. What you usually want is this:

`NSString *booleanString = (value) ? @"True" : @"False";`

Problem

I have following method that does some stringbuilding, but unfortunately i am having problem with parsing the boolean to my NSString. The code is following: ``` - (void)setToolOutput:(int) outputNumber state: (BOOL) value { NSString *str = [NSString stringWithFormat:@"this=%i is=%c",outputNumber,value]; NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding]; [OutputStream write:[data bytes] maxLength:[data length]]; NSLog(@"%@", str); } ``` I have tried to parse it by using `%c` for char, and `%s` as string of chars. Both ways outputs my boolean as a `question mark turned upside down`. EDIT: I want it to parse as `True` or `False`.

Original source