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.
Boolean is basically an integer, so you can use
%ito get its decimal representation.What you usually want is this:
NSString *booleanString = (value) ? @"True" : @"False";