Skip to content

Type MethodFoundationEssentials

identifier(_:from:)

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ macOS 13.0+ tvOS 16.0+ watchOS 9.0+
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 or Locale.IdentifierType.bcp47.

string

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

Return Value

A locale identifier.