3

Without getting into to much detail about the actual program,I want to take an existing string and add more characters(or strings) to it. If this were done in java it would be like this

String x= "hello"

x= x + "world";

I currently have my string trying to do that like this. My string declared is called _whatiscorrect, it is an empty string right now and in this example i want to take the existing string and add an "o" to it.

_whatiscorrect = [_whatiscorrect stringByAppendingString:@"o"]; // place an o in the string

How do i do this?

1 Answer 1

2

You have the right idea. Just do this:

NSMutableString * _whatiscorrect = [[NSMutableString alloc] initWithString: @".."];
[_whatiscorrect appendString:@"o"];
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.