3

If I have a source like his :

val source = Source(List("hell", "o\n my ", "name is bob"))

Is it possible to join and re-split elements on a specific separator pattern, for example on the '\n' character to have something like this as a result? :

Source(List("hello", "my name is bob"))

Thanks!

Loic
  • 3,310
  • 4
  • 25
  • 43

1 Answers1

4

This can be done using Framing :

source.via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 100, allowTruncation = true))
Loic
  • 3,310
  • 4
  • 25
  • 43