fix: coding style and file format.

This commit is contained in:
Bo-Yi Wu
2017-02-10 16:33:02 +08:00
parent 0c9c21e518
commit b27e4d2435
5 changed files with 88 additions and 84 deletions

View File

@@ -8,12 +8,13 @@ import (
func main() {
// count number of characters:
str1 := "asSASA ddd dsjkdsjs dk"
fmt.Printf("The number of bytes in string str1 is %d\n",len(str1))
fmt.Printf("The number of characters in string str1 is %d\n",utf8.RuneCountInString(str1))
fmt.Printf("The number of bytes in string str1 is %d\n", len(str1))
fmt.Printf("The number of characters in string str1 is %d\n", utf8.RuneCountInString(str1))
str2 := "asSASA ddd dsjkdsjsこん dk"
fmt.Printf("The number of bytes in string str2 is %d\n",len(str2))
fmt.Printf("The number of characters in string str2 is %d",utf8.RuneCountInString(str2))
fmt.Printf("The number of bytes in string str2 is %d\n", len(str2))
fmt.Printf("The number of characters in string str2 is %d", utf8.RuneCountInString(str2))
}
/* Output:
The number of bytes in string str1 is 22
The number of characters in string str1 is 22

View File

@@ -15,4 +15,5 @@ func f1() {
func f2() {
print(a) // global variable is taken
}
// GOG

View File

@@ -16,4 +16,5 @@ func m() {
a = "O" // simple assignment: global a gets a new value
print(a)
}
// GOO

View File

@@ -14,4 +14,5 @@ func m() {
a := "O" // new local variable a is declared
print(a)
}
// GOG