fmt函数代表什么意思?

huangapple go评论88阅读模式
英文:

What do the fmt functions stand for?

问题

包名fmt代表"format"(格式化)。我对包内的函数名感到很困惑。以下几个是否正确?

  • Sprint代表"字符串打印"?
  • Sscan代表"字符串扫描"?
  • Fprint代表"格式化打印"?
  • Fscan代表"格式化扫描"?
  • Printf代表"打印格式"?
英文:

The package name fmt stands for "format". I am quite confused by the function names inside the package. Are the following correct?

  • Sprint stands for "string print"?
  • Sscan stands for "string scan"?
  • Fprint stands for "format print"?
  • Fscan stands for "format scan"?
  • Printf stands for "print format"?

答案1

得分: 4

或多或少。除了F*这些与文件相关的事物之外,

  • Fprint代表“文件打印”
  • Fscan代表“文件扫描”

其中,“文件”表示“IO对象”。

这些名称可能看起来令人困惑,但实际上它们与C标准库中的名称相匹配,该标准库存在于上个世纪! :)由于Go定位为系统编程语言,模仿其他系统语言的API是很自然的。

英文:

More or less. Except that F* things are file related

  • Fprint stands for "file print"
  • Fscan stands for "file scan"

Where "file" means "an IO object".

Those names might look confusing, but actually they match names from C stdlib, which exists since the last millennium! fmt函数代表什么意思? As Go is positioned as system programming language, it is natural that they mimic API of the other system language.

huangapple
  • 本文由 发表于 2016年11月17日 19:11:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/40653385.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定