mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 23:52:31 +08:00
[Typo] Fix multiple wrong single and double quotation marks
This commit is contained in:
@@ -162,7 +162,7 @@ func main() {
|
||||
```go
|
||||
package main
|
||||
|
||||
import “fmt”
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var n int16 = 34
|
||||
@@ -171,8 +171,8 @@ func main() {
|
||||
//m = n
|
||||
m = int32(n)
|
||||
|
||||
fmt.Printf(“32 bit int is: %d\n”, m)
|
||||
fmt.Printf(“16 bit int is: %d\n”, n)
|
||||
fmt.Printf("32 bit int is: %d\n", m)
|
||||
fmt.Printf("16 bit int is: %d\n", n)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -198,7 +198,7 @@ func Uint8FromInt(n int) (uint8, error) {
|
||||
if 0 <= n && n <= math.MaxUint8 { // conversion is safe
|
||||
return uint8(n), nil
|
||||
}
|
||||
return 0, fmt.Errorf(“%d is out of the uint8 range”, n)
|
||||
return 0, fmt.Errorf("%d is out of the uint8 range", n)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -213,7 +213,7 @@ func IntFromFloat64(x float64) int {
|
||||
}
|
||||
return int(whole)
|
||||
}
|
||||
panic(fmt.Sprintf(“%g is out of the int32 range”, x))
|
||||
panic(fmt.Sprintf("%g is out of the int32 range", x))
|
||||
}
|
||||
```
|
||||
|
||||
@@ -234,7 +234,7 @@ Go 拥有以下复数类型:
|
||||
|
||||
```go
|
||||
var c1 complex64 = 5 + 10i
|
||||
fmt.Printf(“The value is: %v”, c1)
|
||||
fmt.Printf("The value is: %v", c1)
|
||||
// 输出: 5 + 10i
|
||||
```
|
||||
|
||||
@@ -447,14 +447,14 @@ func main() {
|
||||
|
||||
```go
|
||||
package main
|
||||
import “fmt”
|
||||
import "fmt"
|
||||
|
||||
type TZ int
|
||||
|
||||
func main() {
|
||||
var a, b TZ = 3, 4
|
||||
c := a + b
|
||||
fmt.Printf(“c has the value: %d”, c) // 输出:c has the value: 7
|
||||
fmt.Printf("c has the value: %d", c) // 输出:c has the value: 7
|
||||
}
|
||||
```
|
||||
|
||||
@@ -469,7 +469,7 @@ func main() {
|
||||
在 ASCII 码表中,A 的值是 65,而使用 16 进制表示则为 41,所以下面的写法是等效的:
|
||||
|
||||
```go
|
||||
var ch byte = 65 或 var ch byte = ‘\x41’
|
||||
var ch byte = 65 或 var ch byte = '\x41'
|
||||
```
|
||||
|
||||
(`\x` 总是紧跟着长度为 2 的 16 进制数)
|
||||
@@ -485,13 +485,13 @@ var ch byte = 65 或 var ch byte = ‘\x41’
|
||||
示例 4.12 [char.go](examples/chapter_4/char.go)
|
||||
|
||||
```go
|
||||
var ch int = ‘\u0041’
|
||||
var ch2 int = ‘\u03B2’
|
||||
var ch3 int = ‘\U00101234’
|
||||
fmt.Printf(“%d - %d - %d\n”, ch, ch2, ch3) // integer
|
||||
fmt.Printf(“%c - %c - %c\n”, ch, ch2, ch3) // character
|
||||
fmt.Printf(“%X - %X - %X\n”, ch, ch2, ch3) // UTF-8 bytes
|
||||
fmt.Printf(“%U - %U - %U”, ch, ch2, ch3) // UTF-8 code point
|
||||
var ch int = '\u0041'
|
||||
var ch2 int = '\u03B2'
|
||||
var ch3 int = '\U00101234'
|
||||
fmt.Printf("%d - %d - %d\n", ch, ch2, ch3) // integer
|
||||
fmt.Printf("%c - %c - %c\n", ch, ch2, ch3) // character
|
||||
fmt.Printf("%X - %X - %X\n", ch, ch2, ch3) // UTF-8 bytes
|
||||
fmt.Printf("%U - %U - %U", ch, ch2, ch3) // UTF-8 code point
|
||||
```
|
||||
|
||||
输出:
|
||||
|
Reference in New Issue
Block a user