Objective-C formatting string for boolean?

后端 未结 9 1728
情深已故
情深已故 2020-12-13 11:38

What formatter is used for boolean values?

EDIT:

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

9条回答
  •  眼角桃花
    2020-12-13 12:28

    I believe the easiest way to do this is:

    NSLog(@" %@", @(BOOL_VAL));
    

    @(expression)

    Dynamically evaluates the boxed expression and returns the appropriate object literal based on its value (i.e. NSString for const char*, NSNumber for int, etc.).

提交回复
热议问题