Strings are slices in Google Go, so there is really no need for a Golang substr function. For example if you would want to get the first 10 characters of a string:
dt := "2015-01-01 15:45:12"
d := dt[0:10]
The resulting value in d will be: “2015-01-01”.
Leave a Reply