aboutsummaryrefslogtreecommitdiff
path: root/lib/text/chunk.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/text/chunk.go')
-rw-r--r--lib/text/chunk.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/text/chunk.go b/lib/text/chunk.go
index a904f2bd..10d37936 100644
--- a/lib/text/chunk.go
+++ b/lib/text/chunk.go
@@ -8,6 +8,7 @@ import (
"bytes"
"fmt"
"strconv"
+ "strings"
)
// Chunk represent subset of line, contain starting position and slice of
@@ -20,15 +21,15 @@ type Chunk struct {
// JoinChunks all chunk's values using `sep` as separator and return it as
// string.
func JoinChunks(chunks []Chunk, sep string) string {
- var out string
+ var out strings.Builder
for x := range len(chunks) {
if x > 0 {
- out += sep
+ out.WriteString(sep)
}
- out += string(chunks[x].V)
+ out.WriteString(string(chunks[x].V))
}
- return out
+ return out.String()
}
// MarshalJSON encode the Chunk into JSON value.