AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JS_NewUCStringCopyN (Function)
Summary:     Creates a new Unicode-encoded JS string of a specified size.
Syntax:
JSString * JS_NewUCStringCopyN(JSContext *cx, const jschar *s,
size_t n);

     Argument     Type     Description
     cx     JSContext *     Pointer to a JS context from which to derive runtime information.
                 
     s     const jschar *     Pointer to the Unicode character array containing the text for the JS string to create.
                 
     n     size_t     Maximum number of Unicode characters to copy from s into the JS string.
                 
Description:
JS_NewUCStringCopyN allocates space for a JS string and its underlying storage, and copies as many characters from a Unicode-encoded character array, s, as possible, up to n characters, into the new JS string. If the number of characters in s is greater than the number of characters specified in n, the new JS string contains a truncated version of the original string. If the number of characters in s is less than the number of bytes specified in n, the new JS string is padded with nulls to the specified length.

You can use JS_NewUCStringCopyN to copy binary data, which may contain ASCII 0 characters. You can also use this function when you want to copy only a certain portion of a Unicode-encoded string into a JS string.

If the allocation is successful, JS_NewUCStringCopyN returns a pointer to the JS string. Otherwise it returns NULL.


See also:
JS_CompareStrings
JS_ConvertValue
JS_GetEmptyStringValue
JS_GetStringBytes
JS_GetStringChars
JS_GetStringLength
JS_InternString
JS_InternUCString
JS_InternUCStringN
JS_NewArrayObject
JS_NewDouble
JS_NewFunction
JS_NewObject
JS_NewString
JS_NewStringCopyN
JS_NewStringCopyZ
JS_NewUCString
JS_NewUCStringCopyZ
JS_ValueToString
JS_malloc

[sh-index] Back to list of manuals