---
title: "appending(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsstring/appending(_:)"
---

# appending(_:)

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

## Declaration

```swift
func appending(_ aString: String) -> String
```

## Parameters

- `aString`: The string to append to the receiver. This value must not be nil. important: Raises an NSInvalidArgumentException if aString is nil.

## Return Value

Return Value A new string made by appending aString to the receiver.

## Discussion

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

### Combining Strings

- [appendingFormat(_:_:)](foundation/nsstring/appendingformat(_:_:).md)
- [padding(toLength:withPad:startingAt:)](foundation/nsstring/padding(tolength:withpad:startingat:).md)
