On Wed, 2019-10-09 at 06:02 -0700, Nalin Pushpakumara wrote:
> Hi,
> I tried to print array with brackets and commas in golang. I want to
> get
> array like this.
> ["record1", "record2". "record3"]
>
> Does anyone know how to do it?
>
> Thank you
>
Not the most efficient, but simple and clear
Hello Nalin,
If you use a slice of strings to hold your data, as an alternative you could go
with
fmt.Printf("[%s]", strings.Join(your_slice_of_strings, ","))
Cheers!
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this gr
I tried to print array with brackets and commas in golang. I want to
get
array like this.
["record1", "record2". "record3"]
Encode the array to JSON:
```
package main
import (
"encoding/json"
"fmt"
"log"
"os"
)
func main() {
strings := [3]string{"foo",
Hi,
I tried to print array with brackets and commas in golang. I want to get
array like this.
["record1", "record2". "record3"]
Does anyone know how to do it?
Thank you
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this g