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. 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). Best, Kasper |
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 :
|
Free forum by Nabble | Edit this page |