Contents

JSStringGetUTF8CString(_:_:_:)

Converts a JavaScript string into a null-terminated UTF-8 string, and copies the result into an external byte buffer.

Declaration

func JSStringGetUTF8CString(_ string: JSStringRef!, _ buffer: UnsafeMutablePointer<CChar>!, _ bufferSize: Int) -> Int

Parameters

  • string:

    The source Jsstringref.

  • buffer:

    The destination byte buffer to copy a null-terminated UTF-8 representation of string into. On return, buffer contains a UTF-8 string representation of string. If bufferSize is too small, buffer contains only partial results. If buffer isn’t at least bufferSize bytes in size, the conversion results in undefined behavior.

  • bufferSize:

    The size of the external buffer in bytes.

Return Value

The number of bytes the system writes into buffer (including the null-terminator byte).

See Also

Accessing JavaScript String Information