+[NSString stringWithString:] — what's the point?

后端 未结 7 1779
悲&欢浪女
悲&欢浪女 2020-12-01 16:20

As NSString strings are immutable, what is the value of the stringWithString: class method?

I get the utility when used with NSMutabl

7条回答
  •  臣服心动
    2020-12-01 16:37

    As another use case, if (for whatever reason) you create your own subclass of NSString or NSMutableString, stringWithString: provides a handy way to instantiate it with an instance of either NSString, NSMutableString, or MyCustomString.

提交回复
热议问题