1. <i id='hoVpc'><tr id='hoVpc'><dt id='hoVpc'><q id='hoVpc'><span id='hoVpc'><b id='hoVpc'><form id='hoVpc'><ins id='hoVpc'></ins><ul id='hoVpc'></ul><sub id='hoVpc'></sub></form><legend id='hoVpc'></legend><bdo id='hoVpc'><pre id='hoVpc'><center id='hoVpc'></center></pre></bdo></b><th id='hoVpc'></th></span></q></dt></tr></i><div id='hoVpc'><tfoot id='hoVpc'></tfoot><dl id='hoVpc'><fieldset id='hoVpc'></fieldset></dl></div>
      <bdo id='hoVpc'></bdo><ul id='hoVpc'></ul>

      <small id='hoVpc'></small><noframes id='hoVpc'>

      <tfoot id='hoVpc'></tfoot>

      <legend id='hoVpc'><style id='hoVpc'><dir id='hoVpc'><q id='hoVpc'></q></dir></style></legend>

      布尔到 NSString

      时间:2023-10-05

        <tfoot id='TlHsC'></tfoot>
        <i id='TlHsC'><tr id='TlHsC'><dt id='TlHsC'><q id='TlHsC'><span id='TlHsC'><b id='TlHsC'><form id='TlHsC'><ins id='TlHsC'></ins><ul id='TlHsC'></ul><sub id='TlHsC'></sub></form><legend id='TlHsC'></legend><bdo id='TlHsC'><pre id='TlHsC'><center id='TlHsC'></center></pre></bdo></b><th id='TlHsC'></th></span></q></dt></tr></i><div id='TlHsC'><tfoot id='TlHsC'></tfoot><dl id='TlHsC'><fieldset id='TlHsC'></fieldset></dl></div>

          <small id='TlHsC'></small><noframes id='TlHsC'>

              <tbody id='TlHsC'></tbody>

              <legend id='TlHsC'><style id='TlHsC'><dir id='TlHsC'><q id='TlHsC'></q></dir></style></legend>

              • <bdo id='TlHsC'></bdo><ul id='TlHsC'></ul>
                本文介绍了布尔到 NSString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如果我有一个返回 BOOL 的方法,如何将其转换为 NSString 以便在控制台中打印出来?

                If I have a method that returns a BOOL, how do I cast that to an NSString so I can print it out in console?

                例如,我尝试这样做,但不起作用:

                For example, I tried doing this, which isn't working:

                NSLog(@"Is Kind of NSString:", ([thing isKindOfClass:[NSString class]]) ? @"YES" : @"NO");
                

                但是我真的很想把返回值变成一个 NSString.我知道它是一种原始数据类型,所以我不能在它上面调用方法.我是否必须单独创建一个字符串,然后在 NSString 上的方法中使用 Bool 作为参数?

                But I really want to actually turn the return value into an NSString. I know it's a primitive data type, so I can't call methods on it. Do I have to create a string separately and then use the Bool as a parameter in a method on NSString?

                推荐答案

                您的格式字符串中需要一个格式说明符:

                You need a formatting specifier in your format string:

                NSLog(@"Is Kind of NSString: %@", ([thing isKindOfClass:[NSString class]]) ? @"YES" : @"NO");
                

                这篇关于布尔到 NSString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:设置数组中所有对象的布尔属性 下一篇:Objective-C 中的 bool、Boolean 和 BOOL 之间有什么区别吗?

                相关文章

                <small id='VkEOS'></small><noframes id='VkEOS'>

                  <legend id='VkEOS'><style id='VkEOS'><dir id='VkEOS'><q id='VkEOS'></q></dir></style></legend>

                    <bdo id='VkEOS'></bdo><ul id='VkEOS'></ul>
                  <tfoot id='VkEOS'></tfoot>
                1. <i id='VkEOS'><tr id='VkEOS'><dt id='VkEOS'><q id='VkEOS'><span id='VkEOS'><b id='VkEOS'><form id='VkEOS'><ins id='VkEOS'></ins><ul id='VkEOS'></ul><sub id='VkEOS'></sub></form><legend id='VkEOS'></legend><bdo id='VkEOS'><pre id='VkEOS'><center id='VkEOS'></center></pre></bdo></b><th id='VkEOS'></th></span></q></dt></tr></i><div id='VkEOS'><tfoot id='VkEOS'></tfoot><dl id='VkEOS'><fieldset id='VkEOS'></fieldset></dl></div>