mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:34:15 +08:00
fix: coding style and file format for chapter 7.
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
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
|
||||
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
|
||||
|
Reference in New Issue
Block a user