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 --- pivotTable.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pivotTable.go') diff --git a/pivotTable.go b/pivotTable.go index de671f7..10c48ce 100644 --- a/pivotTable.go +++ b/pivotTable.go @@ -141,7 +141,7 @@ func (f *File) AddPivotTable(opt *PivotTableOption) error { pivotCacheID := f.countPivotCache() + 1 sheetRelationshipsPivotTableXML := "../pivotTables/pivotTable" + strconv.Itoa(pivotTableID) + ".xml" - pivotTableXML := strings.Replace(sheetRelationshipsPivotTableXML, "..", "xl", -1) + pivotTableXML := strings.ReplaceAll(sheetRelationshipsPivotTableXML, "..", "xl") pivotCacheXML := "xl/pivotCache/pivotCacheDefinition" + strconv.Itoa(pivotCacheID) + ".xml" err = f.addPivotCache(pivotCacheXML, opt) if err != nil { @@ -206,7 +206,7 @@ func (f *File) adjustRange(rangeStr string) (string, []int, error) { if len(rng) != 2 { return "", []int{}, ErrParameterInvalid } - trimRng := strings.Replace(rng[1], "$", "", -1) + trimRng := strings.ReplaceAll(rng[1], "$", "") coordinates, err := areaRefToCoordinates(trimRng) if err != nil { return rng[0], []int{}, err -- cgit v1.2.1