且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NSStrings的最后一个单词:Mutable和Immutable

更新时间:2023-11-10 07:52:27

不可变意味着它不能更改为与原始字符串不同的任何。每个字符保持不变,长度不能改变,等等。一旦定义,你不能改变任何关于该字符串。如果你想让它更长或更短或更改任何字符,你需要一个新的字符串(或使用NSMutableString开头)。

The answer is - none. Immutable means it cannot be changed into anything different than the original string. Every character stays the same, the length cannot change, etc. Once it's defined you cannot change anything about that string. If you want to make it longer or shorter or change any of the characters, you need to make a new string (or use a NSMutableString to begin with).