From e81e54f7e23b828c2b42d5cf277251dda7511be1 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 22 Oct 2013 23:05:47 -0700 Subject: go.blog/strings: blog post about strings R=golang-dev, dan.kortschak, iant CC=golang-dev https://golang.org/cl/15460049 --- content/strings/range.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 content/strings/range.go (limited to 'content/strings/range.go') diff --git a/content/strings/range.go b/content/strings/range.go new file mode 100644 index 0000000..1cd4da0 --- /dev/null +++ b/content/strings/range.go @@ -0,0 +1,14 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "fmt" + +func main() { + const nihongo = "日本語" + for index, runeValue := range nihongo { + fmt.Printf("%#U starts at byte position %d\n", runeValue, index) + } +} -- cgit v1.2.3