You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// LastIndex returns the index of the last occurrence of v in s, or -1 if not present.funcLastIndex[S~[]E, Ecomparable](sS, vE) int// LastIndexFunc returns the last index i satisfying f(s[i]), or -1 if none do.funcLastIndexFunc[S~[]E, Eany](sS, ffunc(E) bool) int
which parallels the existence of:
strings.IndexXXX
strings.LastIndexXXX
bytes.IndexXXX
bytes.LastIndexXXX
In my use-case, I'm processing Unicode runes as a []rune and wanted to find the last occurrence of a given rune.
The text was updated successfully, but these errors were encountered:
This makes a lot of sense, but devil's advocate, should we just tell people to do iterutils.Index(slices.Backwards(s), v) in a world where iterutils exists? I think the tricky of it would be that even with slices.Backwards, you run into issues with matching just the value vs. the index. Probably it's worth it anyway.
This makes a lot of sense, but devil's advocate, should we just tell people to do iterutils.Index(slices.Backwards(s), v) in a world where iterutils exists? I think the tricky of it would be that even with slices.Backwards, you run into issues with matching just the value vs. the index. Probably it's worth it anyway.
and according to the quoted comment, neither does iterutils. so I am not sure how much value would be in a suggestion thats not even actionable. also the implementation is dead simple:
I propose the addition of:
which parallels the existence of:
strings.IndexXXX
strings.LastIndexXXX
bytes.IndexXXX
bytes.LastIndexXXX
In my use-case, I'm processing Unicode runes as a
[]rune
and wanted to find the last occurrence of a given rune.The text was updated successfully, but these errors were encountered: