获取number数据的类型

来源:互联网 发布:淘宝定制t恤 编辑:程序博客网 时间:2024/06/06 09:42

if (strcmp([myNumber objCType], @encode(BOOL)) == 0) {

            returnString = @"BOOL";

            NSLog(@"this is a bool");

        } else if (strcmp([myNumber objCType], @encode(int)) == 0) {

            returnString = @"int";            

            NSLog(@"this is an int");

        }

        else if (strcmp([myNumber objCType], @encode(float)) == 0) {

            returnString = @"float";

            NSLog(@"this is an float");

        }

        else if (strcmp([myNumber objCType], @encode(double)) == 0) {

            returnString = @"double";

            NSLog(@"this is an double");

        }。。。。

原创粉丝点击