On 29/08/12 09:54, Michael Schnell wrote:
Nonetheless to me it seems like a nice idea to have String as a sibling of TObjcet which in this case is somehow self-creating and freeing (RefCounting = True) like an interfaced Object.
I'm working on exactly that (well, if I understood your message correctly). It's just an experiment at the moment, but I have implemented a IString interface which declares methods like Count(), Length(), Replace(), Compare(), .SubStr(), .CharAt(), .CodepointAt() etc...
I then have a TString object which is reference counted and implements the IString interface. I then use IString everywhere I would have used String or AnsiString. Internally the string data is in UTF-8, but later I'll make this configurable between UTF-8 and UTF-16.
All the code is unit tested so far, and works quite nicely. My next step is to extend IString to include .ToUTF8(), .ToUTF16() etc, so that it makes it very easy to pass a TString's data to external API's.
Anyway, so far it is an interesting idea [for me], and maybe this experiment will actually go somewhere. :)
Regards, - Graeme - -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
