<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Locale/identifier(_:from:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation6LocaleV10identifier_4fromSSAC14IdentifierTypeO_SStFZ"
  },
  "title" : "identifier(_:from:)"
}
-->

# identifier(_:from:)

Returns the identifier conforming to the specified standard for the specified string.

```
static func identifier(_ type: Locale.IdentifierType, from string: String) -> String
```

## Parameters

`type`

The identifier type used by `string`, such as [`Locale.IdentifierType.icu`](/documentation/Foundation/Locale/IdentifierType/icu) or [`Locale.IdentifierType.bcp47`](/documentation/Foundation/Locale/IdentifierType/bcp47).

`string`

An identifier string that complies with the standard indicated by `type`.

## Return Value

A locale identifier.

## Discussion

---

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)