diff options
author | Eng Zer Jun <engzerjun@gmail.com> | 2022-06-12 00:19:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-12 00:19:12 +0800 |
commit | 6bcf5e4ede160af2ad04f5e69636211a5ced132d (patch) | |
tree | 836568f4c83f24d87acbd26f172f967c7a6a1118 /styles.go | |
parent | f5d3d59d8c65d9396893ae0156fef21592f6f425 (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 'styles.go')
-rw-r--r-- | styles.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2123,7 +2123,7 @@ func newNumFmt(styleSheet *xlsxStyleSheet, style *Style) int { if !currency { return setLangNumFmt(styleSheet, style) } - fc = strings.Replace(fc, "0.00", dp, -1) + fc = strings.ReplaceAll(fc, "0.00", dp) if style.NegRed { fc = fc + ";[Red]" + fc } @@ -3018,7 +3018,7 @@ func drawConfFmtExp(p int, ct string, format *formatConditional) *xlsxCfRule { // getPaletteColor provides a function to convert the RBG color by given // string. func getPaletteColor(color string) string { - return "FF" + strings.Replace(strings.ToUpper(color), "#", "", -1) + return "FF" + strings.ReplaceAll(strings.ToUpper(color), "#", "") } // themeReader provides a function to get the pointer to the xl/theme/theme1.xml |