V
V
v- death2015-10-25 12:22:53
go
v- death, 2015-10-25 12:22:53

How to create a buffer correctly?

Hello. I sit and puzzle over how to create the "correct" buffer. Now I stupidly add data to map. But I think this is not very correct. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Никита, 2015-10-25
@vGrabko99

package main

import (
    "bytes"
    "fmt"
)

func main() {
    var buffer bytes.Buffer

    for i := 0; i < 1000; i++ {
        buffer.WriteString("a")
    }

    fmt.Println(buffer.String())
}

Это пример "сверхбыстрой" конкатинации строк через буфер. Думаю вам помогут исходники bytes.Buffer и buffer.WriteString()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question