V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
Linxing
V2EX  ›  iDev

关于 NSString 字符串连接的问题

  •  
  •   Linxing ·
    linxing · 2014-04-16 20:45:29 +08:00 · 3677 次点击
    这是一个创建于 3634 天前的主题,其中的信息可能已经有所发展或是发生改变。


    不好意思,找到错误了...@Livid 不好意思,删掉下
    9 条回复    1970-01-01 08:00:00 +08:00
    laihj
        1
    laihj  
       2014-04-16 20:54:06 +08:00
    NSString *string;

    改成:
    NSString *string = [NSString string];或NSString *string = @“”;

    调用[string stringByAppendingFormat:@"%@ + %@",string1, string2];时保证string不是null
    Linxing
        2
    Linxing  
    OP
       2014-04-16 21:02:35 +08:00
    @laihj 是啊,刚刚自己看了下,就觉得怎么会这么写。。哈哈哈
    qq2511296
        3
    qq2511296  
       2014-04-16 22:02:21 +08:00
    目测楼主也刚开始学iOS
    alexrezit
        4
    alexrezit  
       2014-04-16 22:18:39 +08:00   ❤️ 1
    nil
    cielpy
        5
    cielpy  
       2014-04-16 22:54:46 +08:00   ❤️ 1
    跟以前声明数据只声明不初始化一样。。
    Linxing
        6
    Linxing  
    OP
       2014-04-17 00:25:53 +08:00
    @qq2511296 哈哈哈,是啊,一起加油。
    cyokvip
        7
    cyokvip  
       2014-04-26 16:48:11 +08:00
    @Linxing me too我也是啊
    Linxing
        8
    Linxing  
    OP
       2014-04-26 18:14:45 +08:00
    @cyokvip ??
    Linxing
        9
    Linxing  
    OP
       2014-04-26 18:15:34 +08:00
    @cyokvip 一楼的解释是对的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1082 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 22:46 · PVG 06:46 · LAX 15:46 · JFK 18:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.