Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_7/string_split2.go
2017-02-11 12:26:05 +08:00

17 lines
275 B
Go
Executable File

package main
import "fmt"
func main() {
str := "Google"
str2 := Split2(str)
fmt.Printf("The string %s transformed is: %s\n", str, str2)
}
func Split2(s string) string {
mid := len(s) / 2
return s[mid:] + s[:mid]
}
// Output: The string Google transformed is: gleGoo