<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/PersonNameComponentsFormatter/personNameComponents(from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersonNameComponentsFormatter(im)personNameComponentsFromString:"
  },
  "title" : "personNameComponents(from:)"
}
-->

# personNameComponents(from:)

Returns a person name components object from a given string.

```
func personNameComponents(from string: String) -> PersonNameComponents?
```

## Parameters

`string`

A string that is parsed to create a person name components object.

## Return Value

An [`NSPersonNameComponents`](/documentation/Foundation/NSPersonNameComponents) object parsing string using the receiver’s format, or `nil` if no components could be parsed.

## Discussion

This method uses a combination of locale rules and heuristics to determine the most likely name components for a particular string representation. Parsing name components from a representation created for an existing name components object may not produce equivalent results.

> Important:
> Currently, only names using Latin or CJK scripts are supported.

Here are some general rules that describe the name component parsing behavior:

- Names in Latin script have components delimited by whitespace.
- Names with a single delimited component are parsed into their most likely name component.
- Names in Latin script with more than two delimited components may include middle components in the `givenName`, `middleName`, or `familyName` name components.
- Names in Latin script that are inverted may be parsed into components in a different order than they appear; names in CJK script that are inverted will not typically produce the correct results.
- Names in Latin script may use a comma to indicate name inversion.
- Names in Latin script have capitalization preserved between string representation and parsed components.
- Text between parentheses or brackets, as well as extraneous characters in names is ignored.

|String                               |`namePrefix`|`givenName`  |`middleName`|`familyName`             |`nameSuffix`|
|-------------------------------------|------------|-------------|------------|-------------------------|------------|
|Jonathan Appleseed                   |            |Jonathan     |            |Appleseed                |            |
|Jonathan Paul Appleseed              |            |Jonathan     |Paul        |Appleseed                |            |
|John Paul Appleseed                  |            |John Paul    |            |Appleseed                |            |
|Jonathan P. Appleseed                |            |Jonathan     |P.          |Appleseed                |            |
|Dr. Jonathan, Esq.                   |Dr.         |Jonathan     |            |                         |Esq.        |
|jonathan appleseed                   |            |jonathan     |            |appleseed                |            |
|Appleseed, Jonathan                  |            |Jonathan     |            |Appleseed                |            |
|Appleseed Jonathan                   |            |Jonathan     |            |Appleseed                |            |
|APPLESEED Jonathan                   |            |Jonathan     |            |APPLESEED                |            |
|Jonathan (a.k.a. Johnny) Appleseed 🍎 |            |Jonathan     |            |Appleseed                |            |
|杨振宁                                  |            |振宁           |            |杨                        |            |
|Jean-Philippe de Zélicourt           |            |Jean-Philippe|            |de Zélicourt             |            |
|Max Mustermann                       |            |Max          |            |Mustermann               |            |
|木田泰夫                                 |            |泰夫           |            |木田                       |            |
|José Ramiro Martín González de Rivera|            |José         |Ramiro      |Martín González de Rivera|            |

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)