//
// main.m
// OC5_NSNumber_NSValue
//
// Created by YIem. on 11/30/15.
// Copyright (c) 2015 www.yiem.net YIem博客. All rights reserved.
//

import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {


// 将非对象<->对象
// 目的: 非对象用于计算 对象用于保存和显示
// NSNumber 数对象
// int -> number
NSNumber *intNum = [NSNumber numberWithInt:100];
NSLog(@"num: %@", intNum);
// number -> int
int a = intNum.intValue;
NSLog(@"int: %d", a);
// 字面量
NSNumber *floatNum = @3.14;
NSLog(@"num: %@", floatNum);
// number -> string
NSString *str = floatNum.stringValue;
NSLog(@"str: %@", str);
// char -> number
NSNumber *charNum = @'a';
NSLog(@"%@", charNum);
// number -> char
NSLog(@"%c", charNum.charValue);
// NSValue 值对象
// range ->value
NSValue *value = [NSValue valueWithRange:NSMakeRange(3, 3)];
NSLog(@"value: %@", value);
// value -> range
NSLog(@"loc: %lu, len: %lu", value.rangeValue.location, value.rangeValue.length);


return 0;

}