frawk icon indicating copy to clipboard operation
frawk copied to clipboard

Split string into constant number of substrings

Open ezrosent opened this issue 3 years ago • 0 comments

Today, frawk supports awk-style splits that populate an array with all of the relevant sub-strings in an (optional) separator. It would be both more succinct and more efficient to support syntax like:

a, b = splitstr("hi:there", ":")

Or similar. Where, the behavior of splitstr compiles down to something like splitn with n given by the number of variables on the left-hand side of the assignment.

This would be particularly helpful when unpacking map keys that are punctuated by SUBSEP.

ezrosent avatar May 29 '21 17:05 ezrosent