0

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"

1 Answer 1

2

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-"];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.