From 92b73c5c2a30df2ca1cb64f7949f7f95cf2f69fd Mon Sep 17 00:00:00 2001 From: j178 <10510431+j178@users.noreply.github.com> Date: Thu, 23 Mar 2023 18:42:41 +0800 Subject: [PATCH] fix: trim in example output --- leetcode/question.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/leetcode/question.go b/leetcode/question.go index 69d38b25..e6b6b9e7 100644 --- a/leetcode/question.go +++ b/leetcode/question.go @@ -442,7 +442,10 @@ func (q *QuestionData) ParseExampleOutputs() []string { result := make([]string, 0, len(found)) // TODO multi-line output, like https://leetcode.cn/problems/find-valid-matrix-given-row-and-column-sums/ for _, f := range found { - output := strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(f[1]), ""), "") + output := strings.TrimSpace(f[1]) + output = strings.TrimPrefix(output, "") + output = strings.TrimSuffix(output, "") + output = strings.TrimSuffix(output, "") output = html2text.HTMLEntitiesToText(output) output = strings.ReplaceAll(output, ", ", ",") result = append(result, output)