Or you can do it manually:

func print(array []string) string {
var buffer strings.Builder
buffer.WriteString("[")
for index, item := range array {
if index != 0 {
buffer.WriteString(", ")
}
buffer.WriteString("\"" + item + "\"")
}
buffer.WriteString("]")
return buffer.String()
}



On Wednesday, October 9, 2019 at 9:25:40 PM UTC+7, 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
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b5801bd6-f73d-4b3f-a5e4-aea363b5a9b5o%40googlegroups.com.

Reply via email to