---
title: "omitSpecificSubdomains(_:includeMultiLevelSubdomains:when:matches:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/url/formatstyle/hostdisplayoption/omitspecificsubdomains(_:includemultilevelsubdomains:when:matches:)"
---

# omitSpecificSubdomains(_:includeMultiLevelSubdomains:when:matches:)

Returns a display option that omits the host component if it matches a set of subdomains and a specified component matches a set of requirements.

## Declaration

```swift
static func omitSpecificSubdomains(_ subdomainsToOmit: Set<String> = Set(), includeMultiLevelSubdomains omitMultiLevelSubdomains: Bool = false, when component: URL.FormatStyle.Component, matches requirements: Set<String>) -> URL.FormatStyle.HostDisplayOption
```

## Parameters

- `subdomainsToOmit`: A set of subdomains to omit, such as [”www”, “mobile”, “m”]. Matching any member of this set omits the host from the formatted output.
- `omitMultiLevelSubdomains`: A Boolean value to manage display of multi-level subdomains. If true, format style omits additional subdomains if there are more than two in addition to the top-level domain (TLD). For example, when this value is true, api.code.developer.example.com becomes developer.example.com, because the TLD is “com”. By comparison, api.code.developer.example.com.cn has a TLD of “com.cn”, so it becomes developer.example.com.cn.
- `component`: A component to compare. This may or may not be the host component itself.
- `requirements`: A set of string values to match against. Matching any member of the set informs the format style to omit the component.

## Return Value

Return Value A display option that omits the host component if it matches a set of subdomains and a specified component meets the specified requirements.

## See Also

### Display options

- [always](foundation/url/formatstyle/hostdisplayoption/always.md)
- [never](foundation/url/formatstyle/hostdisplayoption/never.md)
- [omitIfHTTPFamily](foundation/url/formatstyle/hostdisplayoption/omitifhttpfamily.md)
- [displayWhen(_:matches:)](foundation/url/formatstyle/hostdisplayoption/displaywhen(_:matches:).md)
- [omitWhen(_:matches:)](foundation/url/formatstyle/hostdisplayoption/omitwhen(_:matches:).md)
- [omitSpecificSubdomains(_:includeMultiLevelSubdomains:)](foundation/url/formatstyle/hostdisplayoption/omitspecificsubdomains(_:includemultilevelsubdomains:).md)
- [URL.FormatStyle.Component](foundation/url/formatstyle/component.md)
