From 6bcf5e4ede160af2ad04f5e69636211a5ced132d Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Sun, 12 Jun 2022 00:19:12 +0800 Subject: refactor: replace strings.Replace with strings.ReplaceAll (#1250) strings.ReplaceAll(s, old, new) is a wrapper function for strings.Replace(s, old, new, -1). But strings.ReplaceAll is more readable and removes the hardcoded -1. Signed-off-by: Eng Zer Jun --- sheet.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sheet.go') diff --git a/sheet.go b/sheet.go index 47a2063..7b6e5dc 100644 --- a/sheet.go +++ b/sheet.go @@ -99,9 +99,9 @@ func (f *File) contentTypesWriter() { // and /xl/worksheets/sheet%d.xml func (f *File) getWorksheetPath(relTarget string) (path string) { path = filepath.ToSlash(strings.TrimPrefix( - strings.Replace(filepath.Clean(fmt.Sprintf("%s/%s", filepath.Dir(f.getWorkbookPath()), relTarget)), "\\", "/", -1), "/")) + strings.ReplaceAll(filepath.Clean(fmt.Sprintf("%s/%s", filepath.Dir(f.getWorkbookPath()), relTarget)), "\\", "/"), "/")) if strings.HasPrefix(relTarget, "/") { - path = filepath.ToSlash(strings.TrimPrefix(strings.Replace(filepath.Clean(relTarget), "\\", "/", -1), "/")) + path = filepath.ToSlash(strings.TrimPrefix(strings.ReplaceAll(filepath.Clean(relTarget), "\\", "/"), "/")) } return path } -- cgit v1.2.1