Sky.Core.String
Sky.Core.String — string combinators (Layer 3 Sky source).
Values
append : String -> String -> String
`append a b` — `a` followed by `b` (the same as `a ++ b`).
casefold : String -> String
`casefold s` — `s` in Unicode case-folded form, for case-insensitive comparison.
concat : List String -> String
`concat parts` — the strings of the list joined with nothing between them.
contains : String -> String -> Bool
`contains needle haystack` — `True` when `needle` occurs in `haystack`.
containsIn : String -> String -> Bool
Haystack-first companion to `contains` — built for pipelines.
dropLeft : Int -> String -> String
Drop the first n characters (runes) from s. Elm semantics:
dropRight : Int -> String -> String
Drop the last n characters (runes) from s. Elm semantics:
ellipsize : Int -> String -> String
`truncate n s` with a trailing `…` when anything was cut.
endsWith : String -> String -> Bool
`endsWith suffix s` — `True` when `s` ends with `suffix`.
endsWithIn : String -> String -> Bool
Haystack-first companion to `endsWith`.
equalFold : String -> String -> Bool
`equalFold a b` — `True` when `a` and `b` are equal after Unicode case folding.
foldl : (Char -> b -> b) -> b -> String -> b
`foldl f acc s` — fold over the characters of `s` from the first.
foldr : (Char -> b -> b) -> b -> String -> b
`foldr f acc s` — fold over the characters of `s` from the last.
fromBytes : List Int -> String
Rebuild a string from UTF-8 byte values. Values outside `0..255`
fromChar : Char -> String
`fromChar c` — the one-character string of `c`.
fromFloat : Float -> String
`fromFloat x` — the decimal text of `x`.
fromInt : Int -> String
`fromInt n` — the decimal text of `n`.
fromList : List Char -> String
`fromList chars` — the string of the characters, in order.
graphemes : String -> Int
The number of GRAPHEME CLUSTERS in `s` — `"👨👩👧"` is 1, while
htmlEscape : String -> String
HTML-escape `&`, `<`, `>`, `"` and `'`. `Std.Ui` already escapes
indexes : String -> String -> List Int
`indexes sub s` — the start of every non-overlapping occurrence of
isEmail : String -> Bool
`isEmail s` — `True` when `s` has the form of an email address.
isEmpty : String -> Bool
`isEmpty s` — `True` for `""`.
isUrl : String -> Bool
`isUrl s` — `True` when `s` has the form of an absolute URL.
isValid : String -> Bool
Is `s` well-formed UTF-8?
join : String -> List String -> String
`join sep parts` — the strings of the list with `sep` between each pair.
left : Int -> String -> String
The first `n` runes of `s` (the whole string when `n` exceeds it,
length : String -> Int
`length s` — the number of characters (code points) in `s`.
lines : String -> List String
`lines s` — `s` split at each newline.
normalize : String -> String
Unicode NFC (composed) normalisation.
normalizeNFD : String -> String
Unicode NFD (decomposed) normalisation.
padLeft : Int -> Char -> String -> String
`padLeft n c s` — `s` with `c` added in front until it is `n` characters long.
padRight : Int -> Char -> String -> String
`padRight n c s` — `s` with `c` added at the end until it is `n` characters long.
repeat : Int -> String -> String
`repeat n s` — `n` copies of `s` joined together (`""` when `n` is 0 or less).
replace : String -> String -> String -> String
`replace old new s` — `s` with every `old` replaced by `new`.
reverse : String -> String
`reverse s` — the characters of `s` in reverse order.
right : Int -> String -> String
The last `n` runes of `s`.
slice : Int -> Int -> String -> String
`slice start end s` — the characters from `start` up to, not including, `end`. A negative index counts from the end; the range is clamped.
slugify : String -> String
Lowercase, alphanumerics kept, runs of space/`-`/`_` collapsed to
split : String -> String -> List String
`split sep s` — the parts of `s` between each `sep`.
startsWith : String -> String -> Bool
`startsWith prefix s` — `True` when `s` starts with `prefix`.
startsWithIn : String -> String -> Bool
Haystack-first companion to `startsWith`.
toBytes : String -> List Int
The UTF-8 bytes of `s`, each as an `Int` in `0..255`.
toChar : String -> Char
The first `Char` of `s` (the null character when `s` is empty).
toFloat : String -> Maybe Float
`toFloat s` — the number `s` spells, or `Nothing`.
toInt : String -> Maybe Int
`toInt s` — the whole number `s` spells, or `Nothing`.
toList : String -> List Char
`toList s` — the characters (code points) of `s`, in order.
toLower : String -> String
`toLower s` — `s` in lower case (Unicode).
toUpper : String -> String
`toUpper s` — `s` in upper case (Unicode).
trim : String -> String
`trim s` — `s` without white space at either end.
trimEnd : String -> String
`trimEnd s` — `s` without white space at the end.
trimStart : String -> String
`trimStart s` — `s` without white space at the start.
truncate : Int -> String -> String
The first `n` GRAPHEME CLUSTERS of `s` — never splits a combining
uncons : String -> Maybe ( Char, String )
`uncons s` — the first character and the rest of the string, or
words : String -> List String
`words s` — the words of `s`, split at runs of white space.