no visible @interface for NSMutableString declares the selector 'subStringWithRange' error [closed]

StackOverflow https://stackoverflow.com/questions/20258920

Вопрос

I want first three characters from the below string. My code as follows.

NSMutableString *str = @"test123";
NSMutableString *strTest = [str subStringWithRange:NSMakeRange(0,2)];

But I am getting this error

no visible @interface for NSMutableString declares the selector subStringWithRange error

Advance thanks for proper solution.

Это было полезно?

Решение

Use NSString instead:

NSMutableString *str = @"test123" ;
NSString *strTest = [str substringWithRange:NSMakeRange(0,2)];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top