Q:

NSMutableString not inserting the string at specified position

I have a NSString object "testtimeFrame" which i am converting to NSMutableString object "mutable" and doing insertStringAtIndex method..
my testtimeframe value is 05-8-2012 and i want to insert "0" before 8 but it's showing it as 80 instead of 08..
NSMutableString * mutable = [NSMutableString stringWithString:testtimeFrame];
[mutable insertString:@"0" atIndex:3];
NSLog(@"my day is:%@",mutable);

Thanks

A:

Yes, that is correct behavior. Remember that index always starts at 0!
0: 0
1: 5
2: -
3: 8

So your code is fine! I've just run:
NSMutableString * mutable = [NSMutableString stringWithString:@"05-8-2012"];
[mutable insertString:@"0" atIndex:3];
NSLog(@"my day is:%@",mutable);

And it works great!
You probably have a problem with: testtimeframe

