Search code examples
objective-cstringnsstringstring-formatting

Objective-C formatting string for boolean?


What formatter is used for boolean values?

EDIT:

Example: NSLog(@" ??", BOOL_VAL);, what is ?? ?


Solution

  • One way to do it is to convert to strings (since there are only two possibilities, it isn't hard):

    NSLog(@" %s", BOOL_VAL ? "true" : "false");
    

    I don't think there is a format specifier for boolean values.