chore: add function String.Pos.extract (#11251)
This PR is a preparatory bootstrapping PR for #11240.
This commit is contained in:
parent
61186629d6
commit
59949f89ee
1 changed files with 5 additions and 0 deletions
|
|
@ -822,6 +822,11 @@ def ValidPos.extract {s : @& String} (b e : @& s.ValidPos) : String where
|
|||
bytes := s.bytes.extract b.offset.byteIdx e.offset.byteIdx
|
||||
isValidUTF8 := b.isValidUTF8_extract e
|
||||
|
||||
@[extern "lean_string_utf8_extract"]
|
||||
def Pos.extract {s : @& String} (b e : @& s.ValidPos) : String where
|
||||
bytes := s.bytes.extract b.offset.byteIdx e.offset.byteIdx
|
||||
isValidUTF8 := b.isValidUTF8_extract e
|
||||
|
||||
/-- Creates a `String` from a `String.Slice` by copying the bytes. -/
|
||||
@[inline]
|
||||
def Slice.copy (s : Slice) : String :=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue