Alex Rivera | Logout

Replacing one character in a string in Objective-C

Asked 2011-03-07T18:39:59.123
52

Hoping somebody can help me out - I would like to replace a certain character in a string and am wondering what is the best way to do this?

I know the location of the character, so for example, if I want to change the 3rd character in a string from A to B - how would I code that?

Edit
Report

1 Answer

7

Here is the code:

[aString stringByReplacingCharactersInRange:NSMakeRange(3,1) withString:@"B"];
answered 2011-03-07T18:46:48.360

Your Answer