kasper.osterbye at gmail.com
Tue Feb 4 09:25:02 EST 2020
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
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:
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).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-users