I have a NSMutableAttributedString
that contain values in lower case letters. I need to convert all the lowercase letters to uppercase. We can solve this using uppercaseString
for normal string as:
[string uppercaseString];
How can I change my case for NSMutableAttributedString
? Thanks!
NSMutableAttributedString
class doesn't have uppercaseString
method. So you can use like this..
NSString *str = @"objective-c";
str = [str uppercaseString];
NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:str];
NSLog(@"Attributed String %@",attStr);
And You wanna upper latter in particular range then do something like this...
[attStr replaceCharactersInRange:NSMakeRange(0, 1) withString:@"O"];