Equations
- String.utf8DecodeChar? a i = a.utf8DecodeChar? i
Instances For
Checks whether an array of bytes is a valid UTF-8 encoding of a string.
Equations
Instances For
Consistently de-indents the lines in a string, removing the same amount of leading whitespace from each line such that the least-indented line has no leading whitespace.
The number of leading whitespace characters to remove from each line is determined by counting the
number of leading space (' ') and tab ('\t') characters on lines after the first line that also
contain non-whitespace characters. No distinction is made between tab and space characters; both
count equally.
The least number of leading whitespace characters found is then removed from the beginning of each line. The first line's leading whitespace is not counted when determining how far to de-indent the string, but leading whitespace is removed from it.
Examples:
"Here:\n fun x =>\n x + 1".removeLeadingSpaces = "Here:\nfun x =>\n x + 1""Here:\n\t\tfun x =>\n\t \tx + 1".removeLeadingSpaces = "Here:\nfun x =>\n \tx + 1""Here:\n\t\tfun x =>\n \n\t \tx + 1".removeLeadingSpaces = "Here:\nfun x =>\n\n \tx + 1"
Equations
Instances For
Replaces each \r\n with \n to normalize line endings, but does not validate that there are no
isolated \r characters.
This is an optimized version of String.replace text "\r\n" "\n".
Equations
- text.crlfToLf = String.crlfToLf.go✝ text "" 0 0