淘口令解析

https://download.csdn.net/download/wanmeizty/11286264

 

淘口令解析,首先获取淘宝复制的淘口令信息,过滤无用信息,开始解析淘口令具体代码如下:

demo链接地址:https://download.csdn.net/download/wanmeizty/11286264

/**

 * 解析淘口令

 * @param commondString 复制要解析淘的口令

 * @param compeleteBlock block返回解析结果

 **/

+(void)analyze:(NSString *)commondString compelete:(void (^)(NSString * reslut))compeleteBlock;

 

 

#import "ViewController.h"

 

#import "AnalyzeSDK.h"

 

#define ztyRGBHexAlpha(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1]

@interface ViewController ()

@property (strong,nonatomic) UITextField * text;

@property (strong,nonatomic) UITextView * showResultText;

@end

 

@implementation ViewController

 

- (void)viewDidLoad {

    [super viewDidLoad];

    

    self.text = [[UITextField alloc] initWithFrame:CGRectMake(16, 80, self.view.frame.size.width - 32, 40)];

    self.text.placeholder = @"请输入淘口令";

    self.text.backgroundColor = ztyRGBHexAlpha(0xF9F6F5);

    self.text.text = @"¥EcmQY5n4Gq1¥";

    [self.view addSubview:self.text];

    

    UIButton *  btn = [[UIButton alloc] initWithFrame:CGRectMake(80, 140, self.view.frame.size.width - 160, 40)];

    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

    [btn setTitle:@"开始解析淘口令" forState:UIControlStateNormal];

    [btn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];

    btn.layer.cornerRadius = 20;

    btn.backgroundColor = ztyRGBHexAlpha(0xFF7200);

    [self.view addSubview:btn];

    

    self.showResultText = [[UITextView alloc] initWithFrame:CGRectMake(16, 200, self.view.frame.size.width - 32, self.view.frame.size.height - 260)];

    self.showResultText.backgroundColor = ztyRGBHexAlpha(0xF9F6F5);

    self.showResultText.font = [UIFont systemFontOfSize:15];

    [self.view addSubview:self.showResultText];

    // Do any additional setup after loading the view.

}

 

-(void)click{

    

    __weak __typeof(self) weakSelf = self;

    [AnalyzeSDK analyze:self.text.text compelete:^(NSString *reslut) {

        dispatch_async(dispatch_get_main_queue(), ^{

            __strong typeof(weakSelf) strongSelf = weakSelf;

            strongSelf.showResultText.text = reslut;

        });

    }];

    

}

 

@end

 

demo链接地址:https://download.csdn.net/download/wanmeizty/11286264

 

淘口令截图:

淘口令解析_第1张图片 淘口令解析

 

你可能感兴趣的:(iOS)