[wx-dev] wxArray::Join and wxArray::Split
Armel Asselin
asselin.armel at wanadoo.fr
Sat Jan 13 01:05:16 PST 2007
> FM> in a patch (not yet applied) I've proposed to add the functions:
> FM>
> FM> + wxString Join(const wxString& sep) const;
> FM> + static wxArrayString Split(const wxString &str, const wxString
> &sep);
> FM>
> FM> functions to wxArrayString (the second is a simple call to
> wxStringTokenize).
> FM>
> FM> Vadim suggested to add similar ones also to wxList and wxArray and to
> move this
> FM> discussion to wx-dev, so I'm doing it now.
>
> Just the explain, the reason I'd like to have this as a function instead
> of a member so that it could work with std::vector (and possibly
> std::list,
> ...) later.
>
> Also, these functions, although not rocket-scientifically complicated, are
> less trivial than what your patch implements as they have to do something
> about separators. E.g. when you do Join(":") you must somehow escape any
> colons inside the array elements (and Split() must undo this).
I would probably tell "may" rather than "must" here (though it is logical to
do so you may use such technic in various ways to re-join already-joined
data and double encoding would lead to problems)
HIH
Armel
More information about the wx-dev
mailing list