[Pharo-users] StringSlice

Julien Delplanque julien.delplanque at inria.fr
Tue Feb 4 13:30:51 EST 2020


Hello Kasper,

Looks promising, can help a lot when analyzing Strings.

Will try it next time I need such feature. :-)

Good work!

Julien

Le 4/02/20 à 15:25, Kasper Østerbye a écrit :
> Hi,
>
> I was working on parsing longer texts, and my program was extracting 
> substrings which sometimes were rather large. Not that it actually 
> caused any problems, but it kind of hurt my feel for good code to do that.
>
> It has most surely been done before, but here it is again then, string 
> slices.
> https://github.com/kasperosterbye/StringUtilities
>
> A string slice a substring obtained by a start and an end index into 
> an existing string. It is thus possible to get substrings without 
> copying the bytes of the original string - at least for a large number 
> of operations.
>
> I have spend a lot of energy in getting it to work right with both 
> ByteString and WideString, and to let string slices to be protocol 
> compliant with the whole String protocol (except slices are read-only).
>
> Feel free to enjoy and laugh.
>
> In the work with doing StringSlice as a subclass of String, I 
> collected a few issues in String. Those are mentioned at:
> https://github.com/kasperosterbye/StringUtilities/blob/master/StringIssues.md.
>
> The baseline does not load the tests, but they are there if you want 
> to check that too.
>
> I have tried the library on Pharo 7, 8 and 9 (as of 2020-02-04).
>
> Best,
>
> Kasper
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20200204/d458fdff/attachment.html>


More information about the Pharo-users mailing list