美文网首页
iOS小记 -- NSInteger, int, NSStrin

iOS小记 -- NSInteger, int, NSStrin

作者: 沉睡的麦麦 | 来源:发表于2018-04-19 10:46 被阅读0次

    NSString *testA = @"123";

    NSString *testB = @"789";

        1. 字符串拼接

    NSString *testString = [NSString stringWithFormat:@"%@%@",testA, testB];

        2. 字符转NSInteger

    NSInteger testC = [testString integerValue];

        3. NSInteger转字符

    NSString *testD = [NSString stringWithFormat:@"%ld", testC];

        4. 字符转int

    int intString = [testString intValue];

        5. int转字符

    NSString *stringInt = [NSString stringWithFormat:@"%d", intString];

    相关文章

      网友评论

          本文标题:iOS小记 -- NSInteger, int, NSStrin

          本文链接:https://www.haomeiwen.com/subject/ydoikftx.html