Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to show the UILabel text "sunday" to uppercase "SUN" like that

NSString *strDay = [dic objectForKey:@"day"]; 
NSString *uppercaseString = [strDay uppercaseString];
cell.dayLabel.text = uppercaseString;

Is that the correct method to get that? But I get only uppercase. I want "sunday" to be shown in view like "SUN".

like image 628
Joker Avatar asked Sep 12 '12 11:09

Joker


2 Answers

How about just this

NSString *uppercaseString = [strDay uppercaseString];
cell.dayLabel.text = [uppercaseString substringToIndex:3];

Assuming it has a valid day

like image 108
Sohaib Avatar answered Oct 28 '22 08:10

Sohaib


NSString *strDay = [dic objectForKey:@"day"]; 
NSString* split = [strDay substringToIndex:3];
split=[split uppercaseString];

NSLOG (@"%@",split);

Cheers!

like image 26
iSanjay Avatar answered Oct 28 '22 06:10

iSanjay