Instance Method

appending(_:)

Returns a new string made by appending a given string to the receiver.

Declaration

func appending(_ aString: String) -> String

Parameters

aString

The string to append to the receiver. This value must not be nil.

Return Value

A new string made by appending aString to the receiver.

Discussion

This code excerpt, for example:

NSString *errorTag = @"Error: ";
NSString *errorString = @"premature end of file.";
NSString *errorMessage = [errorTag stringByAppendingString:errorString];

produces the string “Error: premature end of file.”.

See Also

Related Symbols

stringByAppendingFormat:

Returns a string made by appending to the receiver a string constructed from a given format string and the following arguments.