<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/ByteCountFormatter/string(fromByteCount:countStyle:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSByteCountFormatter(cm)stringFromByteCount:countStyle:"
  },
  "title" : "string(fromByteCount:countStyle:)"
}
-->

# string(fromByteCount:countStyle:)

Converts a byte count into the specified string format without creating an `NSNumber` object.

```
class func string(fromByteCount byteCount: Int64, countStyle: ByteCountFormatter.CountStyle) -> String
```

## Parameters

`byteCount`

The byte count.

`countStyle`

The formatter style. See [`ByteCountFormatter.CountStyle`](/documentation/Foundation/ByteCountFormatter/CountStyle-swift.enum) for possible values.

## Return Value

A string containing the formatted `byteCount` value.

## See Also

  [Data Formatting Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DataFormatting/DataFormatting.html#//apple_ref/doc/uid/10000029i)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)