Rename some string formatting outputs

Also rebuild output
This commit is contained in:
Eli Bendersky
2021-09-08 05:46:23 -07:00
parent 33985af4da
commit cf0d050e81
4 changed files with 57 additions and 57 deletions

View File

@@ -88,15 +88,15 @@ func main() {
fmt.Printf("width2: |%6.2f|%6.2f|\n", 1.2, 3.45)
// To left-justify, use the `-` flag.
fmt.Printf("float4: |%-6.2f|%-6.2f|\n", 1.2, 3.45)
fmt.Printf("width3: |%-6.2f|%-6.2f|\n", 1.2, 3.45)
// You may also want to control width when formatting
// strings, especially to ensure that they align in
// table-like output. For basic right-justified width.
fmt.Printf("width3: |%6s|%6s|\n", "foo", "b")
fmt.Printf("width4: |%6s|%6s|\n", "foo", "b")
// To left-justify use the `-` flag as with numbers.
fmt.Printf("str4: |%-6s|%-6s|\n", "foo", "b")
fmt.Printf("width5: |%-6s|%-6s|\n", "foo", "b")
// So far we've seen `Printf`, which prints the
// formatted string to `os.Stdout`. `Sprintf` formats

View File

@@ -1,2 +1,2 @@
99fb572787ffa93dad9c491aec5ce5c7a7516081
L6BkGeaN_p4
2297335ea52cc0ed960153b891d35252636308b4
EZCZX1Uwp6D

View File

@@ -14,11 +14,11 @@ float3: 1.234000E+08
str1: "string"
str2: "\"string\""
str3: 6865782074686973
pointer: 0xc420014090
pointer: 0xc0000ba000
width1: | 12| 345|
width2: | 1.20| 3.45|
float4: |1.20 |3.45 |
width3: | foo| b|
str4: |foo |b |
width3: |1.20 |3.45 |
width4: | foo| b|
width5: |foo |b |
sprintf: a string
io: an error