CertainLach / jrsonnet

Rust implementation of Jsonnet language
MIT License
290 stars 33 forks source link

native implementation of std.splitLimitR #163

Closed tstenner closed 1 month ago

tstenner commented 1 month ago

There are two branches with native implementations of stdlib functions, but none for std.splitLimirR yet.

The function needs either two passes over the string (one reverse scan for the nth separator, another to split it starting at this offset) or a temporary array with string slices. The implementation below uses the second, more readable approach.