Equations
- String.Slice.instHAppend = { hAppend := fun (s : String) (t : String.Slice) => s ++ t.copy }
Checks whether s1 and s2 represent the same string, even if they are slices of
different base strings or different slices within the same string.
The implementation is an efficient equivalent of s1.copy == s2.copy
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- String.Slice.instBEq = { beq := String.Slice.beq }
Creates a String from a String.Slice by copying the bytes.
Instances For
Equations
- String.Slice.instToString = { toString := String.Slice.toString }
Equations
- String.Slice.instHashable = { hash := String.Slice.hash }
Checks whether s is lexicographically smaller than t.
The implementation is an efficient equivalent of decide (s.copy < t.copy).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- String.Slice.instLT = { lt := fun (x y : String.Slice) => x.blt y = true }
Equations
- x.instDecidableLT y = instDecidableEqBool (x.blt y) true
Compares s and t lexicographically.
The implementation is an efficient equivalent of compare s.copy t.copy.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- String.Slice.instOrd = { compare := String.Slice.compare }
Equations
- String.Slice.instLE = { le := fun (x y : String.Slice) => ¬y < x }
Removes the specified number of characters (Unicode code points) from the start of the slice.
If n is greater than the amount of characters in s, returns an empty slice.
Examples:
"red green blue".toSlice.drop 4 == "green blue".toSlice"red green blue".toSlice.drop 10 == "blue".toSlice"red green blue".toSlice.drop 50 == "".toSlice
Instances For
Creates a new slice that contains the first n characters (Unicode code points) of s.
If n is greater than the amount of characters in s, returns s.
Examples:
"red green blue".toSlice.take 3 == "red".toSlice"red green blue".toSlice.take 1 == "r".toSlice"red green blue".toSlice.take 0 == "".toSlice"red green blue".toSlice.take 100 == "red green blue".toSlice
Instances For
Removes the specified number of characters (Unicode code points) from the end of the slice.
If n is greater than the amount of characters in s, returns an empty slice.
Examples:
"red green blue".toSlice.dropEnd 5 == "red green".toSlice"red green blue".toSlice.dropEnd 11 == "red".toSlice"red green blue".toSlice.dropEnd 50 == "".toSlice
Instances For
Creates a new slice that contains the last n characters (Unicode code points) of s.
If n is greater than the amount of characters in s, returns s.
Examples:
"red green blue".toSlice.takeEnd 4 == "blue".toSlice"red green blue".toSlice.takeEnd 1 == "e".toSlice"red green blue".toSlice.takeEnd 0 == "".toSlice"red green blue".toSlice.takeEnd 100 == "red green blue".toSlice
Instances For
Checks whether s1 == s2 if ASCII upper/lowercase are ignored.
Equations
- s1.eqIgnoreAsciiCase s2 = (s1.utf8ByteSize == s2.utf8ByteSize && String.Slice.eqIgnoreAsciiCase.go✝ s1 s1.startPos.offset s2 s2.startPos.offset)
Instances For
Appends the slices in a list of slices, placing the separator s between each pair.
Examples:
", ".toSlice.intercalate ["red".toSlice, "green".toSlice, "blue".toSlice] = "red, green, blue"" and ".toSlice.intercalate ["tea".toSlice, "coffee".toSlice] = "tea and coffee"" | ".toSlice.intercalate ["M".toSlice, "".toSlice, "N".toSlice] = "M | | N"
Equations
- s.intercalate [] = ""
- s.intercalate (a :: as) = String.Slice.intercalate.go✝ a.copy s as
Instances For
Appends all the slices in a list of slices, in order.
Use String.Slice.intercalate to place a separator string between the strings in a list.
Examples:
String.Slice.join ["gr", "ee", "n"] = "green"String.Slice.join ["b", "", "l", "", "ue"] = "blue"String.Slice.join [] = ""
Equations
- String.Slice.join l = List.foldl (fun (r : String) (s : String.Slice) => r ++ s) "" l
Instances For
Converts a string to the Lean compiler's representation of names. The resulting name is
hierarchical, and the string is split at the dots ('.').
"a.b".toSlice.toName is the name a.b, not «a.b». For the latter, use
Name.mkSimple.
Instances For
Equations
- String.Slice.instToFormat = { format := fun (s : String.Slice) => Std.format s.copy }