---
title: "format(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/bytecountformatstyle/format(_:)"
---

# format(_:)

Formats a numeric byte count, using this style.

## Declaration

```swift
func format(_ value: Int64) -> String
```

## Parameters

- `value`: The 64-bit byte count to format.

## Return Value

Return Value A formatted representation of value, formatted according to the style’s configuration.

## Discussion

Discussion Use this method when you want to create a single style instance, and then use it to format multiple values. The following example creates a ByteCountFormatStyle to format values as kilobyte counts, then applies this style to an array of Int64 values. let style = ByteCountFormatStyle(style: .memory,                                  allowedUnits: [.kb],                                  spellsOutZero: true,                                  includesActualByteCount: false,                                  locale: Locale(identifier: "en_US")) let counts: [Int64] = [0, 1024, 2048, 4096, 8192, 16384, 32768, 65536] let formatted = counts.map ( {style.format($0) } ) // ["Zero kB", "1 kB", "2 kB", "4 kB", "8 kB", "16 kB", "32 kB", "64 kB"]

To format a single integer, use the BinaryInteger instance method formatted(_:), passing in an instance of IntegerFormatStyle, or formatted() to use a default style.
