String の値同士を加算演算子 (+) で連結し、新たな String 値を生成することができます。

let string1 = "hello"
let string2 = " there"
var welcome = string1 + string2
// welcome は "hello there"

また、加算代入演算子 (+=) で、String の変数に String の値を付け足すことができます。

var instruction = "look over"
instruction += string2
// instruction は "look over there"

String 型の append() メソッドで、String の変数に Character 文字を付け足すことができます。

let exclamationMark: Character = "!"
welcome.append(exclamationMark)
// welcome は "hello there!"
NOTE
Character 値は 1 文字だけしか持つことができず、Character の変数に String や Character を付け足すことはできません。

Portions of this page are translations based on work created and shared by Apple and used according to terms described in the Creative Commons Attribution 4.0 International License.