布尔值的Objective-C格式化字符串吗? [英] Objective-C formatting string for boolean?

查看:74
本文介绍了布尔值的Objective-C格式化字符串吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪种格式化程序用于布尔值?

What formatter is used for boolean values?

示例:NSLog(@" ??", BOOL_VAL);,什么是???

推荐答案

一种方法是将其转换为字符串(由于只有两种可能,所以并不难):

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.

这篇关于布尔值的Objective-C格式化字符串吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆