The nsAString abstract class represents a character string composed of double-byte storage units. This class is typically used to represent Unicode character arrays.
#include "nsStringAPI.h"
class nsAString { ... };
BeginReadingEndReadingLengthAssignReplaceAppendInsertCutoperator=Assign family of functions.operator+=Append family of functions.The nsAString class is never instantiated directly. It should be instantiated using a subclass, such as nsEmbedString .
nsAString corresponds to the AString and DOMString XPIDL data types. nsAString by itself does not imply a particular character encoding. That is, it may be used to store UTF-16 characters, UCS-2 characters, or any random double-byte data. The character encoding in use for a particular nsAString instance depends on the context in which it is used. If used with XPIDL, then the character encodings of the corresponding XPIDL data types applies.
nsAString may even hold data with embedded null values. Thus, the length of the data contained in the nsAString should be determined by calling the nsAString::Length method.
The methods defined on nsAString are implemented as inline wrappers around the XPCOM string functions, prefixed with NS_String. See, for example, NS_StringGetData.
nsAString::Length, EndReading, NS_StringGetData, nsEmbedString