本文介绍了如何在Xcode中用+替换空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个应用程序,其中有许多URL都是从MySQL服务器调用的。

I am building an app with a lot of urls being called from a MySQL server.

我需要为我的应用程序做的是获取文本字段并发送它(我已经知道该怎么做)但我需要用+(加号)替换空格

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)

推荐答案

试试string方法 - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;

Try with the string method - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;

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

这篇关于如何在Xcode中用+替换空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 15:29