Are there use-cases that you see for this feature that don't fall under String.split/3 with a regex argument?
https://hexdocs.pm/elixir/String.html#split/3 On Tuesday, December 1, 2020 at 11:37:20 AM UTC-6 jonar...@gmail.com wrote: > > This is a generalization of the existing (and oddly specific) > String.chunk/2 function that takes a string and a single-argument predicate > function, returning a list of strings. > > e.g. > String.chunk_by(" foo bar ", &(&1 =~ ~r/\w/)) > # => [" ", "foo", " ", "bar", " "] > > The above example makes problems such as "wrap text at <line limit> > preserving whitespace" or "truncate string to x number of words while > preserving whitespace" simpler. > > The actual change would be pretty small and consist of renaming `chunk` to > `chunk_by`, removing a line, and re-defining `chunk` as a slightly > specialized call to `chunk_by` > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/918eab44-fbf4-4bf8-9330-8868e18fc136n%40googlegroups.com.