Added "rest" argument to wxString::Before{First,Last}().

This allows to search the string just once, in BeforeXXX(), when both the
parts of the string before and after some character are needed instead of
having to do it twice in both BeforeXXX() and AfterXXX().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-10-22 14:17:37 +00:00
parent f48a115976
commit 6becc1e617
5 changed files with 77 additions and 17 deletions

View File

@@ -783,14 +783,32 @@ public:
/**
Gets all characters before the first occurrence of @e ch.
Returns the whole string if @a ch is not found.
@param ch The character to look for.
@param rest Filled with the part of the string following the first
occurrence of @a ch or cleared if it was not found. The same string
is returned by AfterFirst() but it is more efficient to use this
output parameter if both the "before" and "after" parts are needed
than calling both functions one after the other. This parameter is
available in wxWidgets version 2.9.2 and later only.
@return Part of the string before the first occurrence of @a ch.
*/
wxString BeforeFirst(wxUniChar ch) const;
wxString BeforeFirst(wxUniChar ch, wxString *rest = NULL) const;
/**
Gets all characters before the last occurrence of @e ch.
Returns the empty string if @a ch is not found.
@param ch The character to look for.
@param rest Filled with the part of the string following the last
occurrence of @a ch or the copy of this string if it was not found.
The same string is returned by AfterLast() but it is more efficient
to use this output parameter if both the "before" and "after" parts
are needed than calling both functions one after the other. This
parameter is available in wxWidgets version 2.9.2 and later only.
@return Part of the string before the last occurrence of @a ch.
*/
wxString BeforeLast(wxUniChar ch) const;
wxString BeforeLast(wxUniChar ch, wxString *rest = NULL) const;
//@}