<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSNumber/description(withLocale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSNumber(im)descriptionWithLocale:"
  },
  "title" : "description(withLocale:)"
}
-->

# description(withLocale:)

Returns a string that represents the contents of the number object for a given locale.

```
func description(withLocale locale: Any?) -> String
```

## Parameters

`locale`

An object containing locale information with which to format the description. Use `nil` if you don’t want the description formatted.

## Return Value

A string that represents the contents of the number object formatted using the locale information in `locale`.

## Discussion

For example, if you have an `NSNumber` object that has the integer value 522, sending it the [`description(withLocale:)`](/documentation/Foundation/NSNumber/description(withLocale:)) message returns the string “522”.

To obtain the string representation, this method invokes `NSString`’s   [`initWithFormat:locale:`](/documentation/Foundation/NSString/initWithFormat:locale:) method, supplying the format based on the type the `NSNumber` object was created with:

|Data Type         |Format Specification|
|------------------|--------------------|
|char              |%i                  |
|double            |%0.16g              |
|float             |%0.7g               |
|int               |%i                  |
|long              |%li                 |
|long long         |%lli                |
|short             |%hi                 |
|unsigned char     |%u                  |
|unsigned int      |%u                  |
|unsigned long     |%lu                 |
|unsigned long long|%llu                |
|unsigned short    |%hu                 |

---

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)