Instance Method インスタンスメソッド

formatted()

Generates a locale-aware string representation of an instance of person name components using the default format style.

Declaration 宣言

func formatted() -> String

Return Value 戻り値

A string, formatted according to the default style. ある文字列、省略時のスタイルにより書式設定されます。

Discussion 議論

The formatted() method creates a string representation of a person’s name suitable for most uses.


var tlc = PersonNameComponents()
tlc.familyName = "Clark"
tlc.givenName = "Thomas"
tlc.middleName = "Louis"
tlc.namePrefix = "Dr."
tlc.nickname = "Tom"
tlc.nameSuffix = "Esq."


tlc.formatted()
// Thomas Clark

If you want more control over the length and formatting of the name string, consider using the formatted(_:) method and including a format style.

See Also 参照

Formatting Person Name Components