views:

18

answers:

1

I need to insert a string 'GMT' into

"2010-07-13T11:22:33-07:00"

before the last '-' (it could also be a '+') the result should be

"2010-07-13T11:22:33GMT-07:00"
+2  A: 

Have a look at the NSString and NSMutableString documentation. I believe what you're looking for is something along the lines of the following (I haven't tested this code, but judging by the documentation it should work):

NSMutableString* date = @"2010-07-13T11:22:33-07:00";
NSRange r = [date rangeOfString:@"-" options:NSSearchBackwards];
[date replaceCharactersInRange: r withString: @"GMT-"];
Bryan Kyle