<!--
{
  "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/JSStringCreateWithCharacters(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "JavaScriptCore"
    ],
    "preciseIdentifier" : "c:@F@JSStringCreateWithCharacters"
  },
  "title" : "JSStringCreateWithCharacters(_:_:)"
}
-->

# JSStringCreateWithCharacters(_:_:)

Creates a JavaScript string from a buffer of Unicode characters.

```
func JSStringCreateWithCharacters(_ chars: UnsafePointer<JSChar>!, _ numChars: Int) -> JSStringRef!
```

## Parameters

`chars`

The buffer of Unicode characters to copy into the new [`JSStringRef`](/documentation/JavaScriptCore/JSStringRef).

`numChars`

The number of characters to copy from the buffer that `chars` points to.

## Return Value

A [`JSStringRef`](/documentation/JavaScriptCore/JSStringRef) that contains `chars`. Ownership follows [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## 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)