Xcode How to Combined Two Strings with stringWithFormat

Combining two strings in Objective-C in XCode. If you’re familiar with C# the string format is the easiest way to go. In Objective-C it’s stringWithFormat. Here the %@ is the string you’ll add afterwards in the parameters.

NSString *combined = [NSString stringWithFormat:@"%@%@", stringURL, stringSearch];

As you might have notes you can easily add text in between each variable string.

NSString *combined = [NSString stringWithFormat:@"%@ This is in between %@", stringURL, stringSearch];

Objective-C documentation for stringWithFormat: https://developer.apple.com/documentation/foundation/nsstring/1497275-stringwithformat