2018-02-19から1日間の記事一覧
golangの文字列から特定の位置の文字を取り出したい時に [:] を使えます。 package main import ( "fmt" ) func main() { s := "abcdefg" fmt.Printf("%+v\n", s[:]) fmt.Printf("%+v\n", s[1:3]) } /* output > abcdefg > bc */ cf. https://play.golang.or…
golangの文字列から特定の位置の文字を取り出したい時に [:] を使えます。 package main import ( "fmt" ) func main() { s := "abcdefg" fmt.Printf("%+v\n", s[:]) fmt.Printf("%+v\n", s[1:3]) } /* output > abcdefg > bc */ cf. https://play.golang.or…