Documentation

Init.Data.String.Slice

@[implicit_reducible]
def String.Slice.beq (s1 s2 : Slice) :

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

Instances For
    @[implicit_reducible]

    Creates a String from a String.Slice by copying the bytes.

    Instances For
      @[implicit_reducible]
      @[extern lean_slice_hash]
      @[implicit_reducible]
      @[implicit_reducible]
      @[implicit_reducible, extern lean_slice_dec_lt]
      @[implicit_reducible]
      @[implicit_reducible]
      @[implicit_reducible]
      @[inline]
      def String.Slice.startsWith {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ForwardPattern pat] :

      Checks whether the slice (s) begins with the pattern (pat).

      This function is generic over all currently supported patterns.

      Examples:

      Instances For
        inductive String.Slice.SplitIterator {σ : SliceType} {ρ : Type} (pat : ρ) (s : Slice) [Pattern.ToForwardSearcher pat σ] :
        Instances For
          @[implicit_reducible]
          instance String.Slice.instInhabitedSplitIterator {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToForwardSearcher a✝² a✝} :
          Inhabited (SplitIterator a✝² a✝³)
          def String.Slice.instInhabitedSplitIterator.default {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToForwardSearcher a✝² a✝} :
          SplitIterator a✝² a✝³
          Instances For
            @[implicit_reducible]
            @[implicit_reducible]
            instance String.Slice.SplitIterator.instIteratorLoopIdSubsliceOfMonad {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] {pat : ρ} [Pattern.ToForwardSearcher pat σ] {n : Type u_1 → Type u_2} {s : Slice} [Monad n] :
            @[specialize #[3]]
            def String.Slice.splitToSubslice {ρ : Type} {σ : SliceType} (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

            Splits a slice at each subslice that matches the pattern pat.

            The subslices that matched the pattern are not included in any of the resulting subslices. If multiple subslices in a row match the pattern, the resulting list will contain empty strings.

            This function is generic over all currently supported patterns.

            Examples:

            • ("coffee tea water".toSlice.splitToSubslice Char.isWhitespace).toStringList == ["coffee", "tea", "water"]

            • ("coffee tea water".toSlice.splitToSubslice ' ').toStringList == ["coffee", "tea", "water"]

            • ("coffee tea water".toSlice.splitToSubslice " tea ").toStringList == ["coffee", "water"]

            • ("ababababa".toSlice.splitToSubslice "aba").toStringList == ["coffee", "water"]

            • ("baaab".toSlice.splitToSubslice "aa").toStringList == ["b", "ab"]

            Instances For
              @[inline]
              def String.Slice.split {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

              Splits a slice at each subslice that matches the pattern pat.

              The subslices that matched the pattern are not included in any of the resulting subslices. If multiple subslices in a row match the pattern, the resulting list will contain empty strings.

              This function is generic over all currently supported patterns.

              Examples:

              • ("coffee tea water".toSlice.split Char.isWhitespace).toStringList == ["coffee", "tea", "water"]

              • ("coffee tea water".toSlice.split ' ').toStringList == ["coffee", "tea", "water"]

              • ("coffee tea water".toSlice.split " tea ").toStringList == ["coffee", "water"]

              • ("ababababa".toSlice.split "aba").toStringList == ["coffee", "water"]

              • ("baaab".toSlice.split "aa").toStringList == ["b", "ab"]

              Instances For
                inductive String.Slice.SplitInclusiveIterator {σ : SliceType} {ρ : Type} (pat : ρ) (s : Slice) [Pattern.ToForwardSearcher pat σ] :
                Instances For
                  @[implicit_reducible]
                  instance String.Slice.instInhabitedSplitInclusiveIterator {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToForwardSearcher a✝² a✝} :
                  def String.Slice.instInhabitedSplitInclusiveIterator.default {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToForwardSearcher a✝² a✝} :
                  Instances For
                    @[implicit_reducible]
                    @[implicit_reducible]
                    @[specialize #[3]]
                    def String.Slice.splitInclusive {ρ : Type} {σ : SliceType} (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

                    Splits a slice at each subslice that matches the pattern pat. Unlike split the matched subslices are included at the end of each subslice.

                    This function is generic over all currently supported patterns.

                    Examples:

                    • ("coffee tea water".toSlice.splitInclusive Char.isWhitespace).toList == ["coffee ".toSlice, "tea ".toSlice, "water".toSlice]

                    • ("coffee tea water".toSlice.splitInclusive ' ').toList == ["coffee ".toSlice, "tea ".toSlice, "water".toSlice]

                    • ("coffee tea water".toSlice.splitInclusive " tea ").toList == ["coffee tea ".toSlice, "water".toSlice]

                    • ("baaab".toSlice.splitInclusive "aa").toList == ["baa".toSlice, "ab".toSlice]

                    Instances For
                      @[inline]

                      If pat matches a prefix of s, returns the remainder. Returns none otherwise.

                      Use String.Slice.dropPrefix to return the slice unchanged when pat does not match a prefix.

                      This function is generic over all currently supported patterns.

                      Examples:

                      Instances For
                        @[specialize #[2]]

                        If pat matches a prefix of s, returns the remainder. Returns s unmodified otherwise.

                        Use String.Slice.dropPrefix? to return none when pat does not match a prefix.

                        This function is generic over all currently supported patterns.

                        Examples:

                        • "red green blue".toSlice.dropPrefix "red " == "green blue".toSlice

                        • "red green blue".toSlice.dropPrefix "reed " == "red green blue".toSlice

                        • "red green blue".toSlice.dropPrefix 'r' == "ed green blue".toSlice

                        • "red green blue".toSlice.dropPrefix Char.isLower == "ed green blue".toSlice

                        Instances For
                          def String.Slice.replace {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] {α : Type u_1} [ToSlice α] (s : Slice) (pattern : ρ) [Pattern.ToForwardSearcher pattern σ] (replacement : α) :

                          Constructs a new string obtained by replacing all occurrences of pattern with replacement in s.

                          This function is generic over all currently supported patterns. The replacement may be a String or a String.Slice.

                          Examples:

                          • "red green blue".toSlice.replace 'e' "" = "rd grn blu"

                          • "red green blue".toSlice.replace (fun c => c == 'u' || c == 'e') "" = "rd grn bl"

                          • "red green blue".toSlice.replace "e" "" = "rd grn blu"

                          • "red green blue".toSlice.replace "ee" "E" = "red grEn blue"

                          • "red green blue".toSlice.replace "e" "E" = "rEd grEEn bluE"

                          • "aaaaa".toSlice.replace "aa" "b" = "bba"

                          • "abc".toSlice.replace "" "k" = "kakbkck"

                          Instances For
                            @[inline]
                            def String.Slice.drop (s : Slice) (n : Nat) :

                            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
                              @[inline]
                              def String.Slice.dropWhile {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ForwardPattern pat] :

                              Creates a new slice that contains the longest prefix of s for which pat matched (potentially repeatedly).

                              Examples:

                              • "red green blue".toSlice.dropWhile Char.isLower == " green blue".toSlice

                              • "red green blue".toSlice.dropWhile 'r' == "ed green blue".toSlice

                              • "red red green blue".toSlice.dropWhile "red " == "green blue".toSlice

                              • "red green blue".toSlice.dropWhile (fun (_ : Char) => true) == "".toSlice

                              Instances For
                                @[inline]

                                Removes leading whitespace from a slice by moving its start position to the first non-whitespace character, or to its end position if there is no non-whitespace character.

                                “Whitespace” is defined as characters for which Char.isWhitespace returns true.

                                Examples:

                                Instances For
                                  @[inline]
                                  def String.Slice.take (s : Slice) (n : Nat) :

                                  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
                                    @[inline]
                                    def String.Slice.takeWhile {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ForwardPattern pat] :

                                    Creates a new slice that contains the longest prefix of s for which pat matched (potentially repeatedly).

                                    This function is generic over all currently supported patterns.

                                    Examples:

                                    • "red green blue".toSlice.takeWhile Char.isLower == "red".toSlice

                                    • "red green blue".toSlice.takeWhile 'r' == "r".toSlice

                                    • "red red green blue".toSlice.takeWhile "red " == "red red ".toSlice

                                    • "red green blue".toSlice.takeWhile (fun (_ : Char) => true) == "red green blue".toSlice

                                    Instances For
                                      @[inline]
                                      def String.Slice.find? {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

                                      Finds the position of the first match of the pattern pat in a slice s. If there is no match none is returned.

                                      This function is generic over all currently supported patterns.

                                      Examples:

                                      • ("coffee tea water".toSlice.find? Char.isWhitespace).map (·.get!) == some ' '

                                      • "tea".toSlice.find? (fun (c : Char) => c == 'X') == none

                                      • ("coffee tea water".toSlice.find? "tea").map (·.get!) == some 't'

                                      Instances For
                                        @[inline]
                                        def String.Slice.find {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :
                                        s.Pos

                                        Finds the position of the first match of the pattern pat in a slice s. If there is no match s.endPos is returned.

                                        This function is generic over all currently supported patterns.

                                        Examples:

                                        • ("coffee tea water".toSlice.find Char.isWhitespace).get! == ' '

                                        • "tea".toSlice.find (fun (c : Char) => c == 'X') == "tea".toSlice.endPos

                                        • ("coffee tea water".toSlice.find "tea").get! == 't'

                                        Instances For
                                          @[specialize #[5]]
                                          def String.Slice.contains {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

                                          Checks whether a slice has a match of the pattern pat anywhere.

                                          This function is generic over all currently supported patterns.

                                          Examples:

                                          Instances For
                                            @[inline]
                                            def String.Slice.any {ρ : Type} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] (s : Slice) (pat : ρ) [Pattern.ToForwardSearcher pat σ] :

                                            Checks whether a slice has a match of the pattern pat anywhere.

                                            This function is generic over all currently supported patterns.

                                            Examples:

                                            Instances For
                                              @[inline]
                                              def String.Slice.all {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ForwardPattern pat] :

                                              Checks whether a slice only consists of matches of the pattern pat.

                                              Short-circuits at the first pattern mis-match.

                                              This function is generic over all currently supported patterns.

                                              Examples:

                                              Instances For
                                                @[inline]
                                                def String.Slice.endsWith {ρ : Type} (s : Slice) (pat : ρ) [Pattern.BackwardPattern pat] :

                                                Checks whether the slice (s) ends with the pattern (pat).

                                                This function is generic over all currently supported patterns.

                                                Examples:

                                                Instances For
                                                  inductive String.Slice.RevSplitIterator {σ : SliceType} {ρ : Type} (pat : ρ) (s : Slice) [Pattern.ToBackwardSearcher pat σ] :
                                                  Instances For
                                                    @[implicit_reducible]
                                                    instance String.Slice.instInhabitedRevSplitIterator {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToBackwardSearcher a✝² a✝} :
                                                    Inhabited (RevSplitIterator a✝² a✝³)
                                                    def String.Slice.instInhabitedRevSplitIterator.default {a✝ : SliceType} {a✝¹ : Type} {a✝² : a✝¹} {a✝³ : Slice} {a✝⁴ : Pattern.ToBackwardSearcher a✝² a✝} :
                                                    RevSplitIterator a✝² a✝³
                                                    Instances For
                                                      @[implicit_reducible]
                                                      instance String.Slice.RevSplitIterator.instIteratorOfPure {ρ✝ : Type} {ρ : ρ✝} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [Pattern.ToBackwardSearcher ρ σ] {m : TypeType u_1} {s : Slice} [Pure m] :
                                                      @[implicit_reducible]
                                                      instance String.Slice.RevSplitIterator.instIteratorLoopOfMonad {ρ✝ : Type} {ρ : ρ✝} {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [Pattern.ToBackwardSearcher ρ σ] {m : TypeType u_1} {n : Type u_2 → Type u_3} {s : Slice} [Monad m] [Monad n] :
                                                      @[specialize #[3]]
                                                      def String.Slice.revSplit {σ : SliceType} {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ToBackwardSearcher pat σ] :

                                                      Splits a slice at each subslice that matches the pattern pat, starting from the end of the slice and traversing towards the start.

                                                      The subslices that matched the pattern are not included in any of the resulting subslices. If multiple subslices in a row match the pattern, the resulting list will contain empty slices.

                                                      This function is generic over all currently supported patterns except String/String.Slice.

                                                      Examples:

                                                      • ("coffee tea water".toSlice.revSplit Char.isWhitespace).toList == ["water".toSlice, "tea".toSlice, "coffee".toSlice]

                                                      • ("coffee tea water".toSlice.revSplit ' ').toList == ["water".toSlice, "tea".toSlice, "coffee".toSlice]

                                                      Instances For
                                                        @[inline]

                                                        If pat matches a suffix of s, returns the remainder. Returns none otherwise.

                                                        Use String.Slice.dropSuffix to return the slice unchanged when pat does not match a prefix.

                                                        This function is generic over all currently supported patterns.

                                                        Examples:

                                                        Instances For
                                                          @[specialize #[2]]

                                                          If pat matches a suffix of s, returns the remainder. Returns s unmodified otherwise.

                                                          Use String.Slice.dropSuffix? to return none when pat does not match a prefix.

                                                          This function is generic over all currently supported patterns.

                                                          Examples:

                                                          • "red green blue".toSlice.dropSuffix " blue" == "red green".toSlice

                                                          • "red green blue".toSlice.dropSuffix "bluu " == "red green blue".toSlice

                                                          • "red green blue".toSlice.dropSuffix 'e' == "red green blu".toSlice

                                                          • "red green blue".toSlice.dropSuffix Char.isLower == "red green blu".toSlice

                                                          Instances For
                                                            @[inline]

                                                            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
                                                              @[inline]

                                                              Creates a new slice that contains the longest suffix of s for which pat matched (potentially repeatedly).

                                                              Examples:

                                                              Instances For
                                                                @[inline]

                                                                Removes trailing whitespace from a slice by moving its end position to the last non-whitespace character, or to its start position if there is no non-whitespace character.

                                                                “Whitespace” is defined as characters for which Char.isWhitespace returns true.

                                                                Examples:

                                                                Instances For
                                                                  @[inline]

                                                                  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
                                                                    @[inline]

                                                                    Creates a new slice that contains the suffix prefix of s for which pat matched (potentially repeatedly).

                                                                    This function is generic over all currently supported patterns.

                                                                    Examples:

                                                                    Instances For
                                                                      @[specialize #[5]]
                                                                      def String.Slice.revFind? {σ : SliceType} [(s : Slice) → Std.Iterator (σ s) Id (Pattern.SearchStep s)] [(s : Slice) → Std.IteratorLoop (σ s) Id Id] {ρ : Type} (s : Slice) (pat : ρ) [Pattern.ToBackwardSearcher pat σ] :

                                                                      Finds the position of the first match of the pattern pat in a slice, starting from the end of the slice and traversing towards the start. If there is no match none is returned.

                                                                      This function is generic over all currently supported patterns except String/String.Slice.

                                                                      Examples:

                                                                      • ("coffee tea water".toSlice.revFind? Char.isWhitespace).map (·.get!) == some ' '

                                                                      • "tea".toSlice.revFind? (fun (c : Char) => c == 'X') == none

                                                                      Instances For

                                                                        Removes leading and trailing whitespace from a slice.

                                                                        “Whitespace” is defined as characters for which Char.isWhitespace returns true.

                                                                        Examples:

                                                                        Instances For

                                                                          Checks whether s1 == s2 if ASCII upper/lowercase are ignored.

                                                                          Instances For

                                                                            Creates an iterator over all lines in s with the line ending characters \r\n or \n being stripped.

                                                                            Examples:

                                                                            • "foo\r\nbar\n\nbaz\n".toSlice.lines.toList == ["foo".toSlice, "bar".toSlice, "".toSlice, "baz".toSlice]

                                                                            • "foo\r\nbar\n\nbaz".toSlice.lines.toList == ["foo".toSlice, "bar".toSlice, "".toSlice, "baz".toSlice]

                                                                            • "foo\r\nbar\n\nbaz\r".toSlice.lines.toList == ["foo".toSlice, "bar".toSlice, "".toSlice, "baz\r".toSlice]

                                                                            Instances For
                                                                              @[inline]

                                                                              Checks whether the slice can be interpreted as the decimal representation of a natural number.

                                                                              A slice can be interpreted as a decimal natural number if it is not empty and all the characters in it are digits. Underscores (_) are allowed as digit separators for readability, but cannot appear at the start, at the end, or consecutively.

                                                                              Use toNat? or toNat! to convert such a slice to a natural number.

                                                                              Examples:

                                                                              • "".toSlice.isNat = false

                                                                              • "0".toSlice.isNat = true

                                                                              • "5".toSlice.isNat = true

                                                                              • "05".toSlice.isNat = true

                                                                              • "587".toSlice.isNat = true

                                                                              • "1_000".toSlice.isNat = true

                                                                              • "100_000_000".toSlice.isNat = true

                                                                              • "-587".toSlice.isNat = false

                                                                              • " 5".toSlice.isNat = false

                                                                              • "2+3".toSlice.isNat = false

                                                                              • "0xff".toSlice.isNat = false

                                                                              • "_123".toSlice.isNat = false

                                                                              • "123_".toSlice.isNat = false

                                                                              • "12__34".toSlice.isNat = false

                                                                              Instances For

                                                                                Interprets a slice as the decimal representation of a natural number, returning it. Returns none if the slice does not contain a decimal natural number.

                                                                                A slice can be interpreted as a decimal natural number if it is not empty and all the characters in it are digits. Underscores (_) are allowed as digit separators and are ignored during parsing.

                                                                                Use isNat to check whether toNat? would return some. toNat! is an alternative that panics instead of returning none when the slice is not a natural number.

                                                                                Examples:

                                                                                Instances For

                                                                                  Interprets a slice as the decimal representation of a natural number, returning it. Panics if the slice does not contain a decimal natural number.

                                                                                  A slice can be interpreted as a decimal natural number if it is not empty and all the characters in it are digits. Underscores (_) are allowed as digit separators and are ignored during parsing.

                                                                                  Use isNat to check whether toNat! would return a value. toNat? is a safer alternative that returns none instead of panicking when the string is not a natural number.

                                                                                  Examples:

                                                                                  Instances For
                                                                                    @[inline]

                                                                                    Returns the first character in s. If s is empty, returns none.

                                                                                    Examples:

                                                                                    Instances For
                                                                                      @[inline]

                                                                                      Returns the first character in s. If s is empty, returns (default : Char).

                                                                                      Examples:

                                                                                      • "abc".toSlice.front = 'a'

                                                                                      • "".toSlice.front = (default : Char)

                                                                                      Instances For

                                                                                        Checks whether the slice can be interpreted as the decimal representation of an integer.

                                                                                        A slice can be interpreted as a decimal integer if it only consists of at least one decimal digit and optionally - in front. Leading + characters are not allowed.

                                                                                        Use String.Slice.toInt? or String.toInt! to convert such a string to an integer.

                                                                                        Examples:

                                                                                        • "".toSlice.isInt = false

                                                                                        • "-".toSlice.isInt = false

                                                                                        • "0".toSlice.isInt = true

                                                                                        • "-0".toSlice.isInt = true

                                                                                        • "5".toSlice.isInt = true

                                                                                        • "587".toSlice.isInt = true

                                                                                        • "-587".toSlice.isInt = true

                                                                                        • "+587".toSlice.isInt = false

                                                                                        • " 5".toSlice.isInt = false

                                                                                        • "2-3".toSlice.isInt = false

                                                                                        • "0xff".toSlice.isInt = false

                                                                                        Instances For

                                                                                          Interprets a slice as the decimal representation of an integer, returning it. Returns none if the string does not contain a decimal integer.

                                                                                          A string can be interpreted as a decimal integer if it only consists of at least one decimal digit and optionally - in front. Leading + characters are not allowed.

                                                                                          Use Slice.isInt to check whether Slice.toInt? would return some. Slice.toInt! is an alternative that panics instead of returning none when the string is not an integer.

                                                                                          Examples:

                                                                                          Instances For
                                                                                            @[inline]

                                                                                            Interprets a string as the decimal representation of an integer, returning it. Panics if the string does not contain a decimal integer.

                                                                                            A string can be interpreted as a decimal integer if it only consists of at least one decimal digit and optionally - in front. Leading + characters are not allowed.

                                                                                            Use Slice.isInt to check whether Slice.toInt! would return a value. Slice.toInt? is a safer alternative that returns none instead of panicking when the string is not an integer.

                                                                                            Examples:

                                                                                            Instances For
                                                                                              @[inline]

                                                                                              Returns the last character in s. If s is empty, returns none.

                                                                                              Examples:

                                                                                              • "abc".toSlice.back? = some 'c'

                                                                                              • "".toSlice.back? = none

                                                                                              Instances For
                                                                                                @[inline]

                                                                                                Returns the last character in s. If s is empty, returns (default : Char).

                                                                                                Examples:

                                                                                                • "abc".toSlice.back = 'c'

                                                                                                • "".toSlice.back = (default : Char)

                                                                                                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"

                                                                                                  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
                                                                                                      @[implicit_reducible]