This header provides wrapper classes around the frozen string API which are roughly equivalent to the internal string classes.
<map id="classes" name="classes"> <area alt="" coords="963,6,1045,54" href="http://developer.mozilla.org/en/nsAString" shape="rect" title="nsAString"> <area alt="" coords="939,102,1069,150" href="http://developer.mozilla.org/en/nsStringContainer" shape="rect" title="nsStringContainer"> <area alt="" coords="548,198,676,246" href="http://developer.mozilla.org/en/nsString_external" shape="rect" title="nsString_external"> <area alt="" coords="700,198,913,246" href="http://developer.mozilla.org/en/nsDependentSubstring_external" shape="rect" title="nsDependentSubstring_external"> <area alt="" coords="937,198,1071,246" href="http://developer.mozilla.org/en/PromiseFlatString" shape="rect" title="PromiseFlatString"> <area alt="" coords="1095,198,1196,246" href="http://developer.mozilla.org/en/nsAutoString" shape="rect" title="nsAutoString"> <area alt="" coords="5,294,197,342" href="http://developer.mozilla.org/en/nsDependentString_external" shape="rect" title="nsDependentString_external"> <area alt="" coords="221,294,467,342" href="http://developer.mozilla.org/en/NS_ConvertASCIItoUTF16_external" shape="rect" title="NS_ConvertASCIItoUTF16_external"> <area alt="" coords="491,294,733,342" href="http://developer.mozilla.org/en/NS_ConvertUTF8toUTF16_external" shape="rect" title="NS_ConvertUTF8toUTF16_external"> <area alt="" coords="757,294,869,342" href="http://developer.mozilla.org/en/nsLiteralString" shape="rect" title="nsLiteralString"> </map>
Method Overview
Data Members
No public members.
Methods
BeginReading
EndReading
PRUnichar* EndReading() const
- source
CharAt
PRUnichar CharAt(PRUint32) const
- source-
Parameters
- PRUint32 aPos
operator[]
PRUnichar operator[](PRUint32) const
- source-
Parameters
- PRUint32 aPos
First
PRUnichar First() const
- source
BeginWriting
PRUint32 BeginWriting(PRUnichar**, PRUnichar**, PRUint32)
- source-
Get the length, begin writing, and optionally set the length of a string all in one operation. @param newSize Size the string to this length. Pass PR_UINT32_MAX to leave the length unchanged. @return The new length of the string, or 0 if resizing failed.
Parameters
- PRUnichar** begin
- PRUnichar** end
- PRUint32 newSize
PRUnichar* BeginWriting(PRUint32)
- source-
Parameters
- PRUint32 <anonymous>
EndWriting
PRUnichar* EndWriting()
- source
SetLength
PRBool SetLength(PRUint32)
- source-
Parameters
- PRUint32 aLen
Length
PRUint32 Length() const
- source
IsEmpty
PRBool IsEmpty() const
- source
SetIsVoid
void SetIsVoid(PRBool)
- source-
Parameters
- PRBool val
IsVoid
PRBool IsVoid() const
- source
Assign
AssignLiteral
void AssignLiteral(const char*)
- source-
Parameters
- char* aStr
operator=
Replace
void Replace(PRUint32, PRUint32, const PRUnichar*, PRUint32)
- source-
Parameters
- PRUint32 cutStart
- PRUint32 cutLength
- PRUnichar* data
- PRUint32 length
void Replace(PRUint32, PRUint32, PRUnichar)
- source-
Parameters
- PRUint32 cutStart
- PRUint32 cutLength
- PRUnichar c
void Replace(PRUint32, PRUint32, const nsAString&)
- source-
Parameters
- PRUint32 cutStart
- PRUint32 cutLength
- nsAString& readable
Append
AppendLiteral
void AppendLiteral(const char*)
- source-
Parameters
- char* aASCIIStr
operator+=
Insert
Cut
void Cut(PRUint32, PRUint32)
- source-
Parameters
- PRUint32 cutStart
- PRUint32 cutLength
Truncate
void Truncate()
- source
StripChars
void StripChars(const char*)
- source-
Remove all occurences of characters in aSet from the string.
Parameters
- char* aSet
StripWhitespace
void StripWhitespace()
- source-
Strip whitespace characters from the string.
Trim
void Trim(const char*, PRBool, PRBool)
- source-
Parameters
- char* aSet
- PRBool aLeading
- PRBool aTrailing
DefaultComparator
PRInt32 DefaultComparator(const PRUnichar*, const PRUnichar*, PRUint32)
- source-
Parameters
- PRUnichar* a
- PRUnichar* b
- PRUint32 length
Compare(const PRUnichar*, PRInt32 (*)
PRInt32 Compare(const PRUnichar*, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Parameters
- PRUnichar* other
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
Compare(const nsAString&, PRInt32 (*)
PRInt32 Compare(const nsAString&, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Parameters
- nsAString& other
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
Equals(const PRUnichar*, PRInt32 (*)
PRBool Equals(const PRUnichar*, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Parameters
- PRUnichar* other
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
Equals(const nsAString&, PRInt32 (*)
PRBool Equals(const nsAString&, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Parameters
- nsAString& other
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
operator<
operator<=
operator==
operator>=
operator>
operator!=
EqualsLiteral
PRBool EqualsLiteral(const char*) const
- source-
Parameters
- char* aASCIIString
LowerCaseEqualsLiteral
PRBool LowerCaseEqualsLiteral(const char*) const
- source-
Case-insensitive match this string to a lowercase ASCII string.
Parameters
- char* aASCIIString
Find(const nsAString&, PRInt32 (*)
PRInt32 Find(const nsAString&, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Find the first occurrence of aStr in this string. @return the offset of aStr, or -1 if not found
Parameters
- nsAString& aStr
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
Find(const nsAString&, PRUint32, PRInt32 (*)
PRInt32 Find(const nsAString&, PRUint32, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Find the first occurrence of aStr in this string, beginning at aOffset. @return the offset of aStr, or -1 if not found
Parameters
- nsAString& aStr
- PRUint32 aOffset
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
Find
RFind(const nsAString&, PRInt32 (*)
PRInt32 RFind(const nsAString&, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Find the last occurrence of aStr in this string. @return The offset of aStr from the beginning of the string, or -1 if not found.
Parameters
- nsAString& aStr
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
RFind(const nsAString&, PRInt32, PRInt32 (*)
PRInt32 RFind(const nsAString&, PRInt32, PRInt32 (*)(const PRUnichar*, const PRUnichar*, PRUint32)) const
- source-
Find the last occurrence of aStr in this string, beginning at aOffset. @param aOffset the offset from the beginning of the string to begin searching. If aOffset < 0, search from end of this string. @return The offset of aStr from the beginning of the string, or -1 if not found.
Parameters
- nsAString& aStr
- PRInt32 aOffset
- ({type:{variantOf:#1={min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"int"}, min:{value:"-2147483648", type:#1#}, max:{value:"2147483647", type:#1#}, isSigned:true, precision:32, name:"PRInt32", typedef:#1#, loc:{_source_location:461523, file:"../../dist/include/prtypes.h", line:306, column:13}}, parameters:[#3={isPointer:true, precision:64, type:{variantOf:#2={min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"short unsigned int"}, isConst:true, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUnichar", typedef:{variantOf:#2#, min:{value:"0u", type:#2#}, max:{value:"65535u", type:#2#}, isUnsigned:true, precision:16, name:"PRUint16", typedef:#2#, loc:{_source_location:458206, file:"../../dist/include/prtypes.h", line:280, column:24}}, loc:{_source_location:480984, file:"../../dist/include/prtypes.h", line:458, column:18}}}, #3#, {variantOf:#4={min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"unsigned int"}, min:{value:"0u", type:#4#}, max:{value:"4294967295u", type:#4#}, isUnsigned:true, precision:32, name:"PRUint32", typedef:#4#, loc:{_source_location:461404, file:"../../dist/include/prtypes.h", line:305, column:22}}]})* c
RFind
PRInt32 RFind(const char*, PRBool) const
- source-
Find the last occurrence of an ASCII string within this string. @return The offset of aStr from the beginning of the string, or -1 if not found.
Parameters
- char* aStr
- PRBool aIgnoreCase
PRInt32 RFind(const char*, PRInt32, PRBool) const
- source-
Find the last occurrence of an ASCII string beginning at aOffset. @param aOffset the offset from the beginning of the string to begin searching. If aOffset < 0, search from end of this string. @return The offset of aStr from the beginning of the string, or -1 if not found.
Parameters
- char* aStr
- PRInt32 aOffset
- PRBool aIgnoreCase
FindChar
PRInt32 FindChar(PRUnichar, PRUint32) const
- source-
Search for the offset of the first occurrence of a character in a string. @param aOffset the offset from the beginning of the string to begin searching @return The offset of the character from the beginning of the string, or -1 if not found.
Parameters
- PRUnichar aChar
- PRUint32 aOffset
RFindChar
PRInt32 RFindChar(PRUnichar) const
- source-
Search for the offset of the last occurrence of a character in a string. @return The offset of the character from the beginning of the string, or -1 if not found.
Parameters
- PRUnichar aChar
AppendInt
void AppendInt(int, PRInt32)
- source-
Append a string representation of a number.
Parameters
- int aInt
- PRInt32 aRadix
ToInteger
PRInt32 ToInteger(nsresult*, PRUint32) const
- source-
Convert this string to an integer. @param aErrorCode pointer to contain result code. @param aRadix must be 10 or 16
Parameters
- nsresult* aErrorCode
- PRUint32 aRadix