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