Object-C

//
//  ViewController.m
//  helloWorld
//
//  Created by buzz on 15/7/18.
//  Copyright (c) 2015年 lucky. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
//    int i=100;
//    float f =1.1f;
//    double d=2.2;
//    short int si =200;
//    long long int ll = 1112313121L;
//
//    NSLog(@"i=%d size = %lu",i,sizeof(i));
//    NSLog(@"i=%f size = %lu",f,sizeof(f));
//    NSLog(@"i=%e size = %lu",d,sizeof(d));
//    NSLog(@"i=%hi size = %lu",si,sizeof(si));
//    NSLog(@"i=%lli size = %lu",ll,sizeof(ll));
//    NSString* str = @"aaa";
//    char *c = "2342342331232";
//    const char* change = [str UTF8String];
//    NSLog(str);
//    NSLog(@"%s",c);
//    NSLog(@"%s",change);
//    NSString * str=[NSString stringWithFormat:@"姓名:%@ 年龄:%d 邮箱:%@" ,@"雨松momo",25,@"xuanyusong@gmail.com"];
//    NSLog(@"%@",str);
    
//    NSLog(@"only log hello world");
//    NSString *str;
//    NSString *str1 = @"plusaA";
//    NSString *str2=@"+";
//    NSString *str3=@"plusB";
//    str =[NSString stringWithFormat:@"%@ %@ %@", str1, str2, str3];
//    NSLog(@"string plus %@", str);
//    [self putString:@"pass string"];
//    MyClass *myclass = [[MyClass alloc]init];
//    [myclass putclass:@"pass class string"];
//    [MyClass sPutClass:@"s pass class string"];
    
//    NSArray * mArray;
//    mArray = [[NSArray alloc]initWithObjects:@"sss", @"403883172", self, nil];
//    int cou = [mArray count];
//    for (int i=0; i<cou; i++) {
//        NSLog(@"%@", [mArray objectAtIndex:i]);
//    }
//    for (NSString *str in mArray) {
//        NSLog(@"%@", str);
//    }
    
//    NSString *str0 = @"sfdsadfsad";
//    NSString *str1 = [NSString stringWithFormat:@"%@ %d", @"sdfsdfs", 56];
//    NSString *str2 = [NSString stringWithString:@"sfdsfsfd"];
//    NSString *str3=[NSString stringWithUTF8String:"utf-8"];
//    int i =100;
//    char* c="rooxml ";
//    NSString* temp = @"i am a temp";
//    NSString *str4 = [temp stringByAppendingString:temp];
//    NSLog(@"str0 = %@", str0);
//    NSLog(@"str1 = %@", str1);
//    NSLog(@"str2 = %@", str2);
//    NSLog(@"str3 = %@", str3);
//    NSLog(@"str4 = %@", str4);
//    NSString *str = @"sfsadfsadfasdfs";
//    for (int i=0; i<[str length]; i++) {
//        NSLog(@"%d %c",i,[str characterAtIndex:i]);
//    }
//    NSString *a = @"ssss";
//    NSString *b = @"ssst";
//    if ([a isEqualToString:b]) {
//        NSLog(@"==");
//    }
//    if ([a hasPrefix:@"sss"]) {
//        NSLog(@"first ==");
//    }
//    NSString *str=@"my name is rooxml  ";
//    NSLog(@"%@", [str substringFromIndex:4]);
//    NSLog(@"%@", [str substringToIndex:4]);
//    NSLog(@"%@", [str substringWithRange:NSMakeRange(2, 5)]);
//    NSLog(@"%@", [str capitalizedString]);
//    NSLog(@"%@", [str uppercaseString]);
//    NSLog(@"%@", [str lowercaseString]);
//    NSString *a = @"my name is rooxml";
//    NSString *b = @"is";
//    NSLog(@"%d %d", [a rangeOfString:b].location, [a rangeOfString:b].length);
//    NSString *str = [a stringByReplacingCharactersInRange:[a rangeOfString:b] withString:@"ssfd"];
//    str = [a stringByReplacingOccurrencesOfString:@" " withString:@"*"];
//    NSLog(@"%@", str);
    
//    NSMutableString *str = [[NSMutableString alloc] init];
//    [str appendString:@" aaaa ."];
//    [str appendFormat:@" %@ %d",@"sdfsdf", 123123];
//    [str deleteCharactersInRange:[str rangeOfString:@"123"]];
//    [str insertString:@"hello" atIndex:10];
//    NSString *str2;
//    str2 = str;
//    NSLog(@"%@ -,- %@ ", str, str2);
//    NSString *str = @"1121";
//    int i = [str intValue];
//    NSLog(@"%d", i);
//    NSInteger ii =[str integerValue];
//    NSLog(@"%i", ii);
//    NSString *sf = @"fdsfsf3.1415926 sss";
//    double d = [sf floatValue];
//    NSLog(@"%f", d);
    
//    tt = [[text alloc] initWithMy];
//    [tt printInfo];
    
//    MyClass* myClass;
//    myClass = [[MyClass alloc]init];
//    NSArray* array = [NSArray arrayWithObjects:@"fff", @"fsdfds", myClass, nil];
//    int cout = [array count];
//    for (int i=0; i<cout; i++) {
//        NSLog(@"%d %@",i, [array objectAtIndex:i]);
//    }
//    MyClass *myClass = [[MyClass alloc]init];
//    NSMutableArray* array = [NSMutableArray arrayWithCapacity:10];
//    [array addObject:@"fdsfsddfs"];
//    [array addObject:myClass];
//    [array insertObject:@"helloworld" atIndex:1];
//    [array replaceObjectAtIndex:0 withObject:@"replace something!"];
//    [array removeObjectsInArray:array];
//    for (NSObject *obj in array) {
//        NSLog(@"%@", obj);
//    }
    
//    NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"1",@"2",@"55t",@"ddd", nil];
//    NSLog(@"%d", [dictionary count]);
//    for (NSObject *o in [dictionary keyEnumerator]) {
//        NSLog(@"key - %@", o);
//    }
//    for (NSObject *o in [dictionary objectEnumerator]) {
//        NSLog(@"value - %@", o);
//    }
//    NSObject* nsobj = [dictionary objectForKey:@"ddd"];
//    if (nsobj != nil) {
//        NSLog(@"%@", nsobj);
//    }
//    NSMutableDictionary* dictionary = [[NSMutableDictionary alloc]init];
//    [dictionary setObject:@"sdfsdkfj" forKey: @'1'];
//    [dictionary setObject:@"6666" forKey:@"333"];
//    NSObject* obj = [dictionary objectForKey:@'1'];
//    if (obj != nil) {
//        NSLog(@"%@", obj);
//    }
//    NSLog(@"%@",[dictionary allKeys]);
//    NSLog(@"%@",[dictionary allValues]);
    
//    NSSet *set = [NSSet setWithObjects:@"333", @"fsfd555", [NSNumber numberWithInteger:110111], nil];
//    NSLog(@"%d", [set count]);
//    NSString *str =@"110111";
//    if ([set containsObject:str]) {
//        NSLog(str);
//    }
//    NSEnumerator *en = [set objectEnumerator];
//    NSLog(@"%@",[en nextObject]);
//    NSObject *o = [en nextObject];
//    while (o!=nil) {
//        NSLog(@"%@", o);
//        o=[en nextObject];
//    }
//    for (NSObject *n in set) {
//        NSLog(@"%@", n);
//    }
    NSMutableSet *set =[NSMutableSet setWithCapacity:10];
    [set addObject:@"55555"];
    [set addObject:@"dgsdfs342"];
    NSString *str = @"delete";
    [set addObject:str];
    [set removeObject:str];
    for (NSObject *o in set) {
        NSLog(@"%@", o);
    }
    
    
}

-(void)viewDidUnload{
    [super viewDidLoad];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)putString:(NSString *)str{
    NSLog(@"%@", str);
}

@end

 

posted @ 2015-07-21 15:04  Cvjar  阅读(173)  评论(0)    收藏  举报