Re: [go-nuts] How to print arrays with commas and brackets

2020-08-07 Thread 'Dan Kortschak' via golang-nuts
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

[go-nuts] How to print arrays with commas and brackets

2019-10-10 Thread Michele Caci
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

Re: [go-nuts] How to print arrays with commas and brackets

2019-10-09 Thread Lutz Horn
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 :=

[go-nuts] How to print arrays with commas and brackets

2019-10-09 Thread Nalin Pushpakumara
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