The final word on NSStrings: Mutable and Immutable

后端 未结 6 629
忘掉有多难
忘掉有多难 2020-12-16 23:14

I\'ve read in several books... and online... about immutable and mutable strings. They claim \"immutable strings\" can\'t be changed. (But they never define \"change\".)

6条回答
  •  臣服心动
    2020-12-17 00:06

    By default, NSString used in objective C language is immutable. NSMutableString is used to declare & define a mutable string. Nothing in an immutable string can be changed. Not the length, not the characters, nothing.

提交回复
热议问题