XPCOM string functions

XPCOM provides these low-level string functions to let you work with strings; however, it's often better to use one of the string classes rather than directly using these functions.

NS_CStringAppendData
The NS_CStringAppendData function appends data to the existing value of a nsACString instance. This is a low-level API.
NS_CStringCloneData
The NS_CStringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_CStringContainerFinish
The NS_CStringContainerFinish function releases any memory allocated by a nsCStringContainer instance.
NS_CStringContainerInit
The NS_CStringContainerInit function initializes a nsCStringContainer instance for use as a nsACString.
NS_CStringContainerInit2
The NS_CStringContainerInit2 function initializes a nsCStringContainer instance for use as a nsACString.
NS_CStringCopy
The NS_CStringCopy function copies the value from one nsACString instance to another. This is a low-level API.
NS_CStringCutData
The NS_CStringCutData function removes a section of the string's internal buffer. This is a low-level API.
NS_CStringGetData
The NS_CStringGetData function gives the caller read access to the string's internal buffer.
NS_CStringGetMutableData
The NS_CStringGetMutableData function gives the caller write access to the string's internal buffer.
NS_CStringInsertData
The NS_CStringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API.
NS_CStringSetData
The NS_CStringSetData function copies data into the string's internal buffer. This is a low-level API.
NS_CStringSetDataRange
The NS_CStringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API.
NS_CStringToUTF16
The NS_CStringToUTF16 function converts the value of a nsACString instance to UTF-16 and stores the result in a nsAString instance.
NS_StringAppendData
The NS_StringAppendData function appends data to the existing value of a nsAString instance. This is a low-level API.
NS_StringCloneData
The NS_StringCloneData function returns a null-terminated, heap allocated copy of the string's internal buffer.
NS_StringContainerFinish
The NS_StringContainerFinish function releases any memory allocated by a nsStringContainer instance. This is a low-level API.
NS_StringContainerInit
The NS_StringContainerInit function initializes a nsStringContainer instance for use as a nsAString. This is a low-level API.
NS_StringCopy
The NS_StringCopy function copies the value from one nsAString instance to another. This is a low-level API.
NS_StringCutData
The NS_StringCutData function removes a section of the string's internal buffer. This is a low-level API.
NS_StringGetData
The NS_StringGetData function gives the caller access to the string's internal buffer. This is a low-level API.
NS_StringInsertData
The NS_StringInsertData function appends data to the existing value of a nsACString instance. This is a low-level API.
NS_StringSetData
The NS_StringSetData function copies data into the string's internal buffer. This is a low-level API.
NS_StringSetDataRange
The NS_StringSetDataRange function copies data into a section of the string's internal buffer. This is a low-level API.
NS_UTF16ToCString
The NS_UTF16ToCString function converts the value of a nsAString instance from UTF-16 to the specified multi-byte encoding and stores the result in a nsACString instance.

Document Tags and Contributors

 Contributors to this page: Sheppy
 Last updated by: Sheppy,