举个例子
fmt.Println(fmt.Sprintf("%-10s this is a test", “abc”)
将abc这个字符串占位10个字符
现在,如果“10”也是个变量,如何指定?
```go
package main
import ("fmt")
func main(){
fmt.Printf("%0[1]*d",8,123)
}
```
output->
00000123
> http://docs.studygolang.com/pkg/fmt/ Explicit argument indexes:
#2
更多评论
fmt.Println(fmt.Sprintf("%-[1]*s this is a test",10,"abc"))
#3