Contents

append(_:)

Appends the given character to the string.

Declaration

mutating func append(_ c: Character)

Parameters

  • c:

    The character to append to the string.

Discussion

The following example adds an emoji globe to the end of a string.

var globe = "Globe "
globe.append("🌍")
print(globe)
// Prints "Globe 🌍"

See Also

Appending Strings and Characters