I have an NSString
NSString *data = @"abcdefghi";
but I want the data to be the "defghi"
What can I do to change it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could do :
This is using NSMutableString which allows you to delete and add Characters/Strings to itself.
The method used here is deleteCharactersInRange this deletes the letters in the
NSRange, in this case the range has alocationof0, so that it starts at the start, and alengthof3, so it deletes 3 letters in.