<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "JavaScriptCore",
  "identifier" : "/documentation/JavaScriptCore/JSStringGetMaximumUTF8CStringSize(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@F@JSStringGetMaximumUTF8CStringSize"
  },
  "title" : "JSStringGetMaximumUTF8CStringSize(_:)"
}
-->

# JSStringGetMaximumUTF8CStringSize(_:)

Returns the maximum number of bytes a JavaScript string uses when you convert it into a null-terminated UTF-8 string.

```
func JSStringGetMaximumUTF8CStringSize(_ string: JSStringRef!) -> Int
```

## Parameters

`string`

The [`JSStringRef`](/documentation/JavaScriptCore/JSStringRef) with the maximum converted size (in bytes) you want to know.

## Return Value

The maximum number of bytes that might be necessary to convert `string` into a null-terminated UTF-8 string. The number of bytes that the conversion actually ends up requiring can be less than this, but never more.

## Discussion

---

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)