GO語言"fmt"包中"Printf"函數的用法及代碼示例。
用法:
func Printf(format string, a ...any)(n int, err error)
Printf 根據格式說明符格式化並寫入標準輸出。它返回寫入的字節數和遇到的任何寫入錯誤。
例子:
package main
import (
"fmt"
)
func main() {
const name, age = "Kim", 22
fmt.Printf("%s is %d years old.\n", name, age)
// It is conventional not to worry about any
// error returned by Printf.
}
輸出:
Kim is 22 years old.
相關用法
- GO Print用法及代碼示例
- GO Println用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO ParseAddress用法及代碼示例
- GO PlainAuth用法及代碼示例
- GO ParseUint用法及代碼示例
- GO ParseIP用法及代碼示例
- GO Pow10用法及代碼示例
- GO ParseMediaType用法及代碼示例
- GO ParseInt用法及代碼示例
- GO ParseCIDR用法及代碼示例
- GO PutVarint用法及代碼示例
- GO Perm用法及代碼示例
- GO Pipe用法及代碼示例
- GO ParseInLocation用法及代碼示例
- GO PathUnescape用法及代碼示例
- GO ParseDuration用法及代碼示例
- GO ParseFile用法及代碼示例
- GO Parse用法及代碼示例
- GO Pool用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 Printf。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。