Merge pull request #29 from Knorkebrot/master
Remove trailing whitespace, add missing newline
This commit is contained in:
commit
c6b39fbc72
@ -50,7 +50,7 @@ func main() {
|
|||||||
|
|
||||||
// There are also several formatting options for
|
// There are also several formatting options for
|
||||||
// floats. For basic decimal formatting use `%f`.
|
// floats. For basic decimal formatting use `%f`.
|
||||||
fmt.Printf("%f", 78.9)
|
fmt.Printf("%f\n", 78.9)
|
||||||
|
|
||||||
// `%e` and `%E` format the float in (slightly
|
// `%e` and `%E` format the float in (slightly
|
||||||
// different versions of) scientific notation.
|
// different versions of) scientific notation.
|
||||||
@ -99,7 +99,7 @@ func main() {
|
|||||||
// So far we've seen `Printf`, which prints the
|
// So far we've seen `Printf`, which prints the
|
||||||
// formatted string to `os.Stdout`. `Sprintf` formats
|
// formatted string to `os.Stdout`. `Sprintf` formats
|
||||||
// and returns a string without printing it anywhere.
|
// and returns a string without printing it anywhere.
|
||||||
s := fmt.Sprintf("a %s ", "string")
|
s := fmt.Sprintf("a %s", "string")
|
||||||
fmt.Println(s)
|
fmt.Println(s)
|
||||||
|
|
||||||
// You can format+print to `io.Writers` other than
|
// You can format+print to `io.Writers` other than
|
||||||
|
@ -1,23 +1,24 @@
|
|||||||
$ go run string-formatting.go
|
$ go run string-formatting.go
|
||||||
{1 2}
|
{1 2}
|
||||||
{x:1 y:2}
|
{x:1 y:2}
|
||||||
main.point{x:1, y:2}
|
main.point{x:1, y:2}
|
||||||
main.point
|
main.point
|
||||||
true
|
true
|
||||||
123
|
123
|
||||||
1110
|
1110
|
||||||
!
|
!
|
||||||
1c8
|
1c8
|
||||||
78.9000001.234000e+08
|
78.900000
|
||||||
1.234000E+08
|
1.234000e+08
|
||||||
"string"
|
1.234000E+08
|
||||||
"\"string\""
|
"string"
|
||||||
6865782074686973
|
"\"string\""
|
||||||
0x42134100
|
6865782074686973
|
||||||
| 12| 345|
|
0x42135100
|
||||||
| 1.20| 3.45|
|
| 12| 345|
|
||||||
|1.20 |3.45 |
|
| 1.20| 3.45|
|
||||||
|
|1.20 |3.45 |
|
||||||
| foo| b|
|
| foo| b|
|
||||||
|foo |b |
|
|foo |b |
|
||||||
a string
|
a string
|
||||||
an error
|
an error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user