Xcode:如何在 xcode 编辑器中将长字符串包装到下一行

Posted

技术标签:

【中文标题】Xcode:如何在 xcode 编辑器中将长字符串包装到下一行【英文标题】:Xcode: How do I wrap a long string around to the next line in the xcode editor 【发布时间】:2010-09-23 13:00:02 【问题描述】:

我有一个长字符串一个 sql 语句,我想在 xcode 编辑器中将其换行到下一行,我如何将其换行,例如

[db executeUpdate:@"insert into test (rid, one, two, amount, startdate, recurrance) values (nil, ?, ?, ?, ?, ?)",

【问题讨论】:

【参考方案1】:

试试:

[db executeUpdate:@"insert into test (rid, one, two, amount, values"  
                   " startdate, recurrance)(nil, ?, ?, ?, ?, ?)",...

【讨论】:

【参考方案2】:

我有类似的问题...叫我偏执狂...但我喜欢我的 sqlstring 看起来漂亮且易于追踪,以防万一出现问题我使用了 stringWithFormat

示例:

NSString sqlString = [NSString stringWithFormat: @"%@ %@ %@ %@ %@",
                   @"SELECT name, address, phone",
                   @"FROM whateverDatabase",
                   @"LEFT JOIN ...",
                   @"WHERE ...",
                   @"AND ...."];

希望这是您正在寻找的 (我想我在错误的页面上发布了......也许这里更好)

【讨论】:

以上是关于Xcode:如何在 xcode 编辑器中将长字符串包装到下一行的主要内容,如果未能解决你的问题,请参考以下文章