---
title: "resetBytes(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/mutabledataprotocol/resetbytes(in:)"
---

# resetBytes(in:)

Replaces the contents of the data buffer with zeros for the provided range.

## Declaration

```swift
mutating func resetBytes<R>(in range: R) where R : RangeExpression, Self.Index == R.Bound
```

## Parameters

- `range`: The range of bytes to replace with zeros.

## Discussion

Discussion The following example sets the bytes to zero for the bytes identified by the provided range: var dest: [UInt8] = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] dest.resetBytes(in: 1...3) // dest = [0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF]
