zoukankan      html  css  js  c++  java
  • 使用block来解决实现switch解决字符串

      NSString *lookup=@"Hearts";

          typedef void  (^CaseBlock)();

           NSDictionary *diction=@{@"Diamonds":

                                       ^(){

                                            NSLog(@"Riches");

                                      },

        

                                    @"Clubs":

                                       ^(){

                                           NSLog(@"Clubs");

                                        },

                                   @"Spades":

                                       ^(){

                                           NSLog(@"Spades");

                                        },

                                   @"Hearts":

                                        ^(){

            

                                            NSLog(@"Hearts!");

                                        }

            

                                   };

            ( (CaseBlock) diction[lookup])();

  • 相关阅读:
    用Jquery控制文本框只能输入数字和字母
    Math:弧度制
    python学习之案例
    python自动化模块之实践一
    python学习之路 第六天
    python学习之路 第五天
    python学习之路 第四天
    python学习之路 第三天
    python学习之路 第二天
    python学习之路 第一天
  • 原文地址:https://www.cnblogs.com/thbbsky/p/3751543.html
Copyright © 2011-2022 走看看