Closed 2colours closed 1 year ago
I am curious if https://raku.land/zef:thundergnat/String::Splice would cover your use case? Though in looking at the tests, (there is no mention of snip in the docs at all) it looks like snip is more closely related to https://raku.land/zef:thundergnat/List::Divvy so maybe not.
@thundergnat honestly, this is a horribly written issue, and it seems to me that I fundamentally misunderstood what snip
does. https://discord.com/channels/538407879980482560/768511641758466088/1067610507932086372 (discord side) https://irclogs.raku.org/raku-beginner/2023-01-25.html#00:59 (IRC side)
What I wanted (and thought to have found) was indeed more like your String::Splice distro, except:
snip
fits)Here is a better-working snippet than the one in the original message: https://gist.github.com/2colours/d4d247d98fa2d6071069387aaad4844a
At the end of the day, I'm considering closing this issue because the inspiration of it was the misunderstanding that snip
did the same thing but for lists.
Perhaps you're looking String::Fields
Yes - I like this interface a lot, even if it isn't exactly the same I described. Seems useful for some oldschool text based data format as well, never a bad thing if one has to deal with log files a lot. :)
Anyway, the issue turned out to be mis-aimed so it seems appropriate to close it.
snip got added to the language, starting with v6.e. It would be useful to have something similar for strins, the way there is
contains
,index
orflip
as well.This would allow "splitting" strings not only by content but also by position.
…