用另一个字符串替换 NSMutableString

发布于 2024-12-20 15:37:23 字数 86 浏览 4 评论 0原文

我想用另一个字符串替换 NSMutableString (不是字符串的一部分,而是完整的字符串)

我尝试了不同的方法,但找不到更好的解决方案。

I want to replace NSMutableString with another String (Not a part of string but complete string)

I tried different approaches but couldnt find a better solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

女皇必胜 2024-12-27 15:37:23

您需要使用名为 setString 的东西。这将用您想要的任何新字符串覆盖以前的字符串。

尝试 -

[yourMutableString setString:@"new string"];

检查 NSMutableString doc< /a>.还有其他方法,例如 appendString 等。

You need to use something called setString. This will over-write the previous string with whatever new string you want.

Try -

[yourMutableString setString:@"new string"];

Check NSMutableString doc. There are other methods like appendString etc.

哎呦我呸! 2024-12-27 15:37:23

[NSMutableString stringWithString:xxxx];是解决方案。很简单!

[NSMutableString stringWithString:xxxx]; is the solution. That was simple!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文