Pad s : String with repeated occurrences of c : Char until it's of length n.
If s is initially larger than n, just return s.
Equations
- String.leftpad n c s = { data := List.leftpad n c s.data }
Instances For
Construct the string consisting of n copies of the character c.
Equations
- String.replicate n c = { data := List.replicate n c }
Instances For
Pad s : String with repeated occurrences of c : Char on the right until it's of length n.
If s is initially larger than n, just return s.
Equations
- String.rightpad n c s = s ++ String.replicate (n - s.length) c
Instances For
String.mapTokens c f s tokenizes s : string on c : char, maps f over each token, and
then reassembles the string by intercalating the separator token c over the mapped tokens.
Equations
- String.mapTokens c f = (String.singleton c).intercalate ∘ List.map f ∘ fun (x : String) => x.split fun (x : Char) => decide (x = c)
Instances For
@[deprecated String.dropPrefix?]
Alias of String.dropPrefix?.
If pre is a prefix of s, i.e. s = pre ++ t, returns the remainder t.
Equations
Instances For
Produce the head character from the string s, if s is not empty, otherwise 'A'.
Equations
- s.head = s.iter.curr