Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Insert

« XPCOM API Reference

Summary

The Insert family of functions inserts a value into a string's internal buffer.

 void Insert(
   const self_type& aString,
   index_type aPosition
 );

Parameters

aString
[in] A nsACString to append to this string.
aPosition
[in] An offset into the string's internal buffer specifying where to place the given characters.
 void Insert(
   const char_type* aData,
   index_type aPosition,
   size_type aDataLength = PR_UINT32_MAX
 );

Parameters

aData
[in] A raw character array to append to this string.
aPosition
[in] An offset into the string's internal buffer specifying where to place the given characters.
aDataLength
[in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated.
 void Insert(
   char_type aChar,
   index_type aPosition
 );

Parameters

aChar
[in] A character to append to this string.
aPosition
[in] An offset into the string's internal buffer specifying where to place the given characters.

Remarks

If insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer.

Document Tags and Contributors

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