Documentation

Init.Data.String.Bootstrap

@[reducible, inline, deprecated String.Pos.Raw (since := "2025-09-30")]
Equations
Instances For
    @[extern lean_string_push]

    Adds a character to the end of a string.

    The internal implementation uses dynamic arrays and will perform destructive updates if the string is not shared.

    Examples:

    • "abc".push 'd' = "abcd"
    • "".push 'a' = "a"
    Equations
    • x✝¹.push x✝ = match x✝¹, x✝ with | { bytes := b, isValidUTF8 := h }, c => { bytes := b.append [c].utf8Encode, isValidUTF8 := }
    Instances For
      @[inline]

      Returns a new string that contains only the character c.

      Because strings are encoded in UTF-8, the resulting string may take multiple bytes.

      Examples:

      Equations
      Instances For
        @[extern lean_string_posof]
        @[extern lean_string_offsetofpos]
        @[extern lean_string_utf8_extract]
        @[extern lean_string_length]
        @[extern lean_string_pushn]
        opaque String.Internal.pushn (s : String) (c : Char) (n : Nat) :
        @[extern lean_string_append]
        @[extern lean_string_utf8_next]
        @[extern lean_string_isempty]
        @[extern lean_string_foldl]
        opaque String.Internal.foldl (f : StringCharString) (init s : String) :
        @[extern lean_string_isprefixof]
        @[extern lean_string_any]
        opaque String.Internal.any (s : String) (p : CharBool) :
        @[extern lean_string_contains]
        @[extern lean_string_utf8_get]
        @[extern lean_string_capitalize]
        @[extern lean_string_utf8_at_end]
        @[extern lean_string_nextwhile]
        @[extern lean_string_trim]
        @[extern lean_string_intercalate]
        @[extern lean_string_front]
        @[extern lean_string_drop]
        @[extern lean_string_dropright]
        @[extern lean_string_get_byte_fast]
        @[extern lean_string_mk]
        def String.mk (data : List Char) :

        Creates a string that contains the characters in a list, in order.

        Examples:

        Equations
        Instances For
          @[inline]

          Creates a string that contains the characters in a list, in order.

          Examples:

          Equations
          Instances For
            @[extern lean_substring_tostring]
            @[extern lean_substring_drop]
            @[extern lean_substring_front]
            @[extern lean_substring_takewhile]
            @[extern lean_substring_extract]
            @[extern lean_substring_all]
            @[extern lean_substring_beq]
            @[extern lean_substring_isempty]
            @[extern lean_substring_get]
            @[extern lean_substring_prev]
            @[extern lean_string_pos_sub]
            @[extern lean_string_pos_min]
            opaque String.Pos.Raw.Internal.min (p₁ p₂ : Raw) :
            @[inline]

            Constructs a singleton string that contains only the provided character.

            Examples:

            Equations
            Instances For