NSMutableString *selectDay=@"Wed 14 May";
[selectDay stringByAppendingFormat:@"%i", yearNumber];
NSLog(@"%@",selectDay);
I will tried this one.But it can't append the yearNumber to that String please help me.YearNumber contain 2011.
stringByAppendingFormat: returns the new string, it does not modify the receiver string. That's why you are getting no change. Try this:
NSMutableString *selectDay=@"Wed 14 May";
NSString *newString = [selectDay stringByAppendingFormat:@"%i", yearNumber];
NSLog(@"%@", newString);
Or this:
NSMutableString *selectDay=@"Wed 14 May";
NSString *newString = [NSString stringWithFormat:@"%@%i", selectDay, yearNumber];
NSLog(@"%@", newString);
EDIT: Actually you don't need mutable string for this. selectDay should be a normal NSString.
NSString *selectDay=@"Wed 14 May";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With