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
This proposes to add Seq.splitAround(separator): (Seq, Seq) which splits a sequence in all items before and after the first item that is equal to the given separator.
SplitAround is useful for a very common string operation for which no handy operator exists. For example:
Ideally, the result uses the same concrete type of sequence as the given sequence. E.g. String.splitAround returns a pair of Strings and Vector.splitAround returns a pair of Vectors.
In addition, it would be nice to have a similar splitAroundLast which splits around the last separator value.
both the first and the last occurance are useful as a split point here in my experience. and it maybe nice to stay with the concrete collection so e.g. Vector.splitAround returns a pair of Vectors.
This proposes to add
Seq.splitAround(separator): (Seq, Seq)
which splits a sequence in all items before and after the first item that is equal to the given separator.SplitAround
is useful for a very common string operation for which no handy operator exists. For example:A simple implementation would be:
Ideally, the result uses the same concrete type of sequence as the given sequence. E.g.
String.splitAround
returns a pair ofString
s andVector.splitAround
returns a pair ofVector
s.In addition, it would be nice to have a similar
splitAroundLast
which splits around the last separator value.(Updated after @ritschwumm 's comment.)
The text was updated successfully, but these errors were encountered: