iphone - 如何去除字符串中的空格?

标签 iphone objective-c

我有一个字符串 "Allentown, pa"

如何使用 objective c 去除 ,pa 之间的空白?

最佳答案

这将从 myString 中删除所有空格。

NSString *newString = [myString stringByReplacingOccurrencesOfString:@" " withString:@""];

关于iphone - 如何去除字符串中的空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6608420/

相关文章:

iphone - 蓝牙管理器 : Don't get any "BluetoothDeviceDiscoveredNotification"

objective-c - 失去对 uisearchbar 的关注时退出键盘

objective-c - Cocos2d 3.0 中的 SimpleAudioEngine

ios - 布局 View 位于另一个以编程方式创建的 View 下方

iphone - 如何在 iOS 中通过 3G 连接创建无线热点

iphone - Objective-C 2.0中带下划线的实例变量和@synthetize重命名导致Xcode 4的 'Analyze'工具优化警告

iphone - iPhone AppStore的UITableViewCell背景色

ios - 在 iOS 中单击本地通知时不打开应用程序

iphone - Objective c - UIActivityViewController 方向模式

objective-c - iOS App在调用方法时等待HTTP响应?