friedbrice/elm-teaching-tools/1.0.0

NOTE: the latest version is 1.0.1

ElmTeachingTools.Lib.String

Extra functions to make working with strings easier.

toInts : String -> Maybe (List Int)

Parse a comma-separated list of ints.

--| Example.
toInts "2,3,4,-1"
--> Just [2, 3, 4, -1]


--| Entire parse fails if parsing any element fails.
toInts "2,3,lolwut,-1"
--> Nothing
fromInts : List Int -> String

Print a comma-separated list of ints.

--| Example.
fromInts [2, 3, 4, -1]
--> "2,3,4,-1"
{ prefix : String
, infix : String
, suffix : String
}
-> (a -> String)
-> List a
-> String

Format a list into a string.

--| Example.
format { prefix = "<", infix = ":", suffix = ">" } String.fromInt [3,4,5]
--> "<3:4:5>"