简体   繁体   English

如何在Xcode中用+替换空格

[英]How do i replace spaces with +'s in Xcode

I am building an app with a lot of urls being called from a MySQL server. 我正在构建一个带有从MySQL服务器调用的许多URL的应用程序。

What I need to do for my app is take the textfield text and send it (which i already know how to do) BUT i need to replace the spaces with + (pluses) 我需要为我的应用程序做的是获取文本字段文本并将其发送(我已经知道该怎么做),但是我需要用+(加号)替换空格

尝试使用字符串方法- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;

str=[str stringByReplacingOccurrencesOfString:@" " withString:@"+"];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM