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

后端 未结 7 1776
悲&欢浪女
悲&欢浪女 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:39

    Returns a string created by copying the characters from another given string

    [NSString stringWithString:@"some string"]
    

    It is equivalent to

    [[[NSString alloc] initWithString:@"some string"] autorelease]
    

提交回复
热议问题