---
title: "string(from:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/bytecountformatter/string(from:)"
---

# string(from:)

Formats the value of the given measurement using the receiver’s countStyle.

## Declaration

```swift
func string(from measurement: Measurement<UnitInformationStorage>) -> String
```

## Discussion

Discussion Converts the measurement to the units allowed by the receiver’s allowedUnits before formatting; depending on the value of the measurement, this may result in a string which implies an approximate value (e.g. if the measurement is too large to represent in allowedUnits, like 1e20 YB expressed in NSByteCountFormatterUseBytes). Throws an exception if the given measurement’s unit does not belong to the NSUnitInformationStorage dimension.
