adauguet/elm-spanned-string/1.0.1

SpannedString

This is a tiny package that allows you to span substrings in a given string.

Definition

type alias SpannedString =
List ( String, Bool )

A SpannedString is just an alias to List (String, Bool).

span : String -> List Int -> SpannedString

Create a SpannedString from a given string and a list of indices.

span "Hello world!" [ 0, 1, 2, 3, 4 ] == [ ( "Hello", True ), ( " world!", False ) ]


span "47 Rue Falguière, Paris" [ 8, 9, 10 ] == [ ( "47 Rue ", False ), ( "Fal", True ), ( "guière, Paris", False ) ]