---
title: "append(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/string/append(_:)-4xa8f"
---

# append(_:)

Appends the given string to this string.

## Declaration

```swift
mutating func append(_ other: String)
```

## Parameters

- `other`: Another string.

## Discussion

Discussion The following example builds a customized greeting by using the append(_:) method: var greeting = "Hello, " if let name = getUserName() {     greeting.append(name) } else {     greeting.append("friend") } print(greeting) // Prints "Hello, friend"

## See Also

### Appending Strings and Characters

- [append(_:)](swift/string/append(_:)-4xi3j.md)
- [append(contentsOf:)](swift/string/append(contentsof:)-oxek.md)
- [append(contentsOf:)](swift/string/append(contentsof:)-9vb4t.md)
- [append(contentsOf:)](swift/string/append(contentsof:)-7est5.md)
- [append(contentsOf:)](swift/string/append(contentsof:)-9foms.md)
- [reserveCapacity(_:)](swift/string/reservecapacity(_:).md)
- [+(_:_:)](swift/string/+(_:_:).md)
- [+=(_:_:)](swift/string/+=(_:_:).md)
- [+(_:_:)](swift/string/+(_:_:)-6h59y.md)
- [+(_:_:)](swift/string/+(_:_:)-n329.md)
- [+(_:_:)](swift/string/+(_:_:)-9fm57.md)
- [+=(_:_:)](swift/string/+=(_:_:)-676gx.md)
