refactor: simplify String.splitOnAux (#2271)

This commit is contained in:
Bulhwi Cha 2023-07-19 20:50:27 +09:00 committed by GitHub
parent e1b3f10250
commit 367b38701f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -247,7 +247,7 @@ termination_by _ => s.endPos.1 - i.1
def splitOnAux (s sep : String) (b : Pos) (i : Pos) (j : Pos) (r : List String) : List String :=
if h : s.atEnd i then
let r := if sep.atEnd j then ""::(s.extract b (i - j))::r else (s.extract b i)::r
let r := (s.extract b i)::r
r.reverse
else
have := Nat.sub_lt_sub_left (Nat.gt_of_not_le (mt decide_eq_true h)) (lt_next s _)