---
title: "TXTRecordContainsKey(_:_:_:)"
framework: dnssd
role: symbol
role_heading: Function
path: "dnssd/txtrecordcontainskey(_:_:_:)"
---

# TXTRecordContainsKey(_:_:_:)

Allows you to determine if a given TXT Record contains a specified key.

## Declaration

```swift
func TXTRecordContainsKey(_ txtLen: UInt16, _ txtRecord: UnsafeRawPointer!, _ key: UnsafePointer<CChar>!) -> Int32
```

## Parameters

- `txtLen`: The size of the received TXT Record.
- `txtRecord`: Pointer to the received TXT Record bytes.
- `key`: A null-terminated ASCII string containing the key name.

## Return Value

Return Value Returns 1 if the TXT Record contains the specified key. Otherwise, it returns 0.

## See Also

### TXT Record Parsing Functions

- [DNSServiceCreateDelegateConnection](dnssd/dnsservicecreatedelegateconnection.md)
- [DNSServiceSetDispatchQueue(_:_:)](dnssd/dnsservicesetdispatchqueue(_:_:).md)
- [TXTRecordGetCount(_:_:)](dnssd/txtrecordgetcount(_:_:).md)
- [TXTRecordGetItemAtIndex(_:_:_:_:_:_:_:)](dnssd/txtrecordgetitematindex(_:_:_:_:_:_:_:).md)
- [TXTRecordGetValuePtr(_:_:_:_:)](dnssd/txtrecordgetvalueptr(_:_:_:_:).md)
