+ const char* sz, size_t nCount = npos) const;
+ int compare(size_t nStart, size_t nLen,
+ const wchar_t* sz, size_t nCount = npos) const;
+
+ // insert another string
+ wxString& insert(size_t nPos, const wxString& str)
+ { insert(begin() + nPos, str.begin(), str.end()); return *this; }
+ // insert n chars of str starting at nStart (in str)
+ wxString& insert(size_t nPos, const wxString& str, size_t nStart, size_t n)
+ {
+ size_t from, len;
+ str.PosLenToImpl(nStart, n, &from, &len);
+ m_impl.insert(PosToImpl(nPos), str.m_impl, from, len);
+ return *this;
+ }
+ // insert first n (or all if n == npos) characters of sz
+ wxString& insert(size_t nPos, const char *sz)
+ { m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; }
+ wxString& insert(size_t nPos, const wchar_t *sz)
+ { m_impl.insert(PosToImpl(nPos), ImplStr(sz)); return *this; }
+ wxString& insert(size_t nPos, const char *sz, size_t n)
+ {
+ SubstrBufFromMB str(ImplStr(sz, n));
+ m_impl.insert(PosToImpl(nPos), str.data, str.len);
+ return *this;
+ }
+ wxString& insert(size_t nPos, const wchar_t *sz, size_t n)
+ {
+ SubstrBufFromWC str(ImplStr(sz, n));
+ m_impl.insert(PosToImpl(nPos), str.data, str.len);
+ return *this;
+ }
+ // insert n copies of ch
+ wxString& insert(size_t nPos, size_t n, wxUniChar ch)
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.insert(PosToImpl(nPos), wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.insert(PosToImpl(nPos), n, (wxStringCharType)ch);
+ return *this;
+ }
+ iterator insert(iterator it, wxUniChar ch)
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ {
+ size_t pos = IterToImplPos(it);
+ m_impl.insert(pos, wxStringOperations::EncodeChar(ch));
+ return iterator(this, m_impl.begin() + pos);
+ }
+ else
+#endif
+ return iterator(this, m_impl.insert(it.impl(), (wxStringCharType)ch));
+ }
+ void insert(iterator it, const_iterator first, const_iterator last)
+ { m_impl.insert(it.impl(), first.impl(), last.impl()); }
+#if WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+ void insert(iterator it, const char *first, const char *last)
+ { insert(it - begin(), first, last - first); }
+ void insert(iterator it, const wchar_t *first, const wchar_t *last)
+ { insert(it - begin(), first, last - first); }
+ void insert(iterator it, const wxCStrData& first, const wxCStrData& last)
+ { insert(it, CreateConstIterator(first), CreateConstIterator(last)); }
+#endif // WXWIN_COMPATIBILITY_STRING_PTR_AS_ITER
+
+ void insert(iterator it, size_type n, wxUniChar ch)
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.insert(IterToImplPos(it), wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.insert(it.impl(), n, (wxStringCharType)ch);
+ }
+
+ // delete characters from nStart to nStart + nLen
+ wxString& erase(size_type pos = 0, size_type n = npos)
+ {
+ size_t from, len;
+ PosLenToImpl(pos, n, &from, &len);
+ m_impl.erase(from, len);
+ return *this;
+ }
+ // delete characters from first up to last
+ iterator erase(iterator first, iterator last)
+ { return iterator(this, m_impl.erase(first.impl(), last.impl())); }
+ iterator erase(iterator first)
+ { return iterator(this, m_impl.erase(first.impl())); }
+
+#ifdef wxSTRING_BASE_HASNT_CLEAR
+ void clear() { erase(); }
+#else
+ void clear() { m_impl.clear(); }
+#endif
+
+ // replaces the substring of length nLen starting at nStart
+ wxString& replace(size_t nStart, size_t nLen, const char* sz)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, ImplStr(sz));
+ return *this;
+ }
+ wxString& replace(size_t nStart, size_t nLen, const wchar_t* sz)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, ImplStr(sz));
+ return *this;
+ }
+ // replaces the substring of length nLen starting at nStart
+ wxString& replace(size_t nStart, size_t nLen, const wxString& str)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, str.m_impl);
+ return *this;
+ }
+ // replaces the substring with nCount copies of ch
+ wxString& replace(size_t nStart, size_t nLen, size_t nCount, wxUniChar ch)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.replace(from, len, wxStringOperations::EncodeNChars(nCount, ch));
+ else
+#endif
+ m_impl.replace(from, len, nCount, (wxStringCharType)ch);
+ return *this;
+ }
+ // replaces a substring with another substring
+ wxString& replace(size_t nStart, size_t nLen,
+ const wxString& str, size_t nStart2, size_t nLen2)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ size_t from2, len2;
+ str.PosLenToImpl(nStart2, nLen2, &from2, &len2);
+
+ m_impl.replace(from, len, str.m_impl, from2, len2);
+ return *this;
+ }
+ // replaces the substring with first nCount chars of sz
+ wxString& replace(size_t nStart, size_t nLen,
+ const char* sz, size_t nCount)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ SubstrBufFromMB str(ImplStr(sz, nCount));
+
+ m_impl.replace(from, len, str.data, str.len);
+ return *this;
+ }
+ wxString& replace(size_t nStart, size_t nLen,
+ const wchar_t* sz, size_t nCount)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+
+ SubstrBufFromWC str(ImplStr(sz, nCount));
+
+ m_impl.replace(from, len, str.data, str.len);
+ return *this;
+ }
+ wxString& replace(size_t nStart, size_t nLen,
+ const wxString& s, size_t nCount)
+ {
+ size_t from, len;
+ PosLenToImpl(nStart, nLen, &from, &len);
+ m_impl.replace(from, len, s.m_impl.c_str(), s.LenToImpl(nCount));
+ return *this;
+ }
+
+ wxString& replace(iterator first, iterator last, const char* s)
+ { m_impl.replace(first.impl(), last.impl(), ImplStr(s)); return *this; }
+ wxString& replace(iterator first, iterator last, const wchar_t* s)
+ { m_impl.replace(first.impl(), last.impl(), ImplStr(s)); return *this; }
+ wxString& replace(iterator first, iterator last, const char* s, size_type n)
+ {
+ SubstrBufFromMB str(ImplStr(s, n));
+ m_impl.replace(first.impl(), last.impl(), str.data, str.len);
+ return *this;
+ }
+ wxString& replace(iterator first, iterator last, const wchar_t* s, size_type n)
+ {
+ SubstrBufFromWC str(ImplStr(s, n));
+ m_impl.replace(first.impl(), last.impl(), str.data, str.len);
+ return *this;
+ }
+ wxString& replace(iterator first, iterator last, const wxString& s)
+ { m_impl.replace(first.impl(), last.impl(), s.m_impl); return *this; }
+ wxString& replace(iterator first, iterator last, size_type n, wxUniChar ch)
+ {
+#if wxUSE_UNICODE_UTF8
+ if ( !ch.IsAscii() )
+ m_impl.replace(first.impl(), last.impl(),
+ wxStringOperations::EncodeNChars(n, ch));
+ else
+#endif
+ m_impl.replace(first.impl(), last.impl(), n, (wxStringCharType)ch);
+ return *this;
+ }
+ wxString& replace(iterator first, iterator last,
+ const_iterator first1, const_iterator last1)
+ {
+ m_impl.replace(first.impl(), last.impl(), first1.impl(), last1.impl());
+ return *this;
+ }
+ wxString& replace(iterator first, iterator last,
+ const char *first1, const char *last1)
+ { replace(first, last, first1, last1 - first1); return *this; }
+ wxString& replace(iterator first, iterator last,
+ const wchar_t *first1, const wchar_t *last1)
+ { replace(first, last, first1, last1 - first1); return *this; }
+
+ // swap two strings
+ void swap(wxString& str)
+ { m_impl.swap(str.m_impl); }
+
+ // find a substring
+ size_t find(const wxString& str, size_t nStart = 0) const
+ { return PosFromImpl(m_impl.find(str.m_impl, PosToImpl(nStart))); }
+
+ // find first n characters of sz
+ size_t find(const char* sz, size_t nStart = 0, size_t n = npos) const
+ {
+ SubstrBufFromMB str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t find(const wchar_t* sz, size_t nStart = 0, size_t n = npos) const
+ {
+ SubstrBufFromWC str(ImplStr(sz, n));
+ return PosFromImpl(m_impl.find(str.data, PosToImpl(nStart), str.len));
+ }
+ size_t find(const wxCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxWCharBuffer& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.data(), nStart, n); }
+ size_t find(const wxCStrData& s, size_t nStart = 0, size_t n = npos) const
+ { return find(s.AsWChar(), nStart, n); }
+
+ // find the first occurence of character ch after nStart
+ size_t find(wxUniChar ch, size_t nStart = 0) const
+ {
+ return PosFromImpl(m_impl.find(wxStringOperations::EncodeChar(ch),
+ PosToImpl(nStart)));
+ }
+ size_t find(wxUniCharRef ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(char ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(unsigned char ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }
+ size_t find(wchar_t ch, size_t nStart = 0) const
+ { return find(wxUniChar(ch), nStart); }