adauguet / elm-spanned-string / SpannedString

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

Definition


type alias SpannedString =
List ( String, Basics.Bool )

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

span : String -> List Basics.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 ) ]