summaryrefslogtreecommitdiff
path: root/pivotTable.go
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2022-06-12 00:19:12 +0800
committerGitHub <noreply@github.com>2022-06-12 00:19:12 +0800
commit6bcf5e4ede160af2ad04f5e69636211a5ced132d (patch)
tree836568f4c83f24d87acbd26f172f967c7a6a1118 /pivotTable.go
parentf5d3d59d8c65d9396893ae0156fef21592f6f425 (diff)
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 <engzerjun@gmail.com>
Diffstat (limited to 'pivotTable.go')
-rw-r--r--pivotTable.go4
1 files changed, 2 insertions, 2 deletions
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