Summary
The BeginReading function returns a const pointer to the first element of the string's internal buffer.
const char_type* BeginReading() const;
Remarks
The resulting character array is not necessarily null-terminated. The length of the array is determined by the result of the Length method.
Example Code
  // count the number of times a particular character appears in the string
  PRUint32 CountChar(const nsACString& str, char c)
  {
    const char* start = str.BeginReading();
    const char* end = str.EndReading();
    PRUint32 count = 0;
    while (start != end)
    {
      if (*start++ == c)
        ++count;
    }
    return count;
  }