string_split2.go 287 B

123456789101112131415
  1. package main
  2. import "fmt"
  3. func main() {
  4. str := "Google"
  5. str2 := Split2(str)
  6. fmt.Printf("The string %s transformed is: %s\n", str, str2)
  7. }
  8. func Split2(s string) string {
  9. mid := len(s) / 2
  10. return s[mid:] + s[:mid]
  11. }
  12. // Output: The string Google transformed is: gleGoo