splitter

Efficiently slice prefixes from strings. Good for parsers!

Package Version Hex Docs

gleam add splitter@1
import splitter

pub fn main() -> Nil {
  let line_ends = splitter.new(["\n", "\r\n"])

  splitter.split(line_ends, "1. Bread\n2. Milk\n")
  // -> #("1. Bread", "\n", "2. Milk")

  splitter.split(line_ends, "No end of line here!")
  // -> #("No end of line here!", "", "")
}

Further documentation can be found at https://hexdocs.pm/splitter.

Search Document