Home  >  Article  >  Backend Development  >  What does the Golang formatting symbol %b mean?

What does the Golang formatting symbol %b mean?

angryTom
angryTomOriginal
2020-03-17 14:42:596472browse

What does the Golang formatting symbol %b mean?

Golang格式化符号%b是什么意思

Golang中格式化符号%b表示一个二进制整数值(基数为2),或者是一个(高级的)用科学计数法表示的指数为2的浮点数。

相关推荐:golang教程

Golang中其他格式化符号的含义如下所示:

%%    一个%字面量    
%c    字符型。可以把输入的数字按照ASCII码相应转换为对应的字符    
%d    一个十进制数值(基数为10)    
%e    以科学记数法e表示的浮点数或者复数值    
%E    以科学记数法E表示的浮点数或者复数值    
%f    以标准记数法表示的浮点数或者复数值    
%g    以%e或者%f表示的浮点数或者复数,任何一个都以最为紧凑的方式输出    
%G    以%E或者%f表示的浮点数或者复数,任何一个都以最为紧凑的方式输出    
%o    一个以八进制表示的数字(基数为8)    
%p    以十六进制(基数为16)表示的一个值的地址,前缀为0x,字母使用小写的a-f表示    
%q    使用Go语法以及必须时使用转义,以双引号括起来的字符串或者字节切片[]byte,或者是以单引号括起来的数字    
%s    字符串。输出字符串中的字符直至字符串中的空字符(字符串以'\0‘结尾,这个'\0'即空字符)    
%t    以true或者false输出的布尔值    
%T    使用Go语法输出的值的类型    
%U    一个用Unicode表示法表示的整型码点,默认值为4个数字字符    
%v    使用默认格式输出的内置或者自定义类型的值,或者是使用其类型的String()方式输出的自定义值,如果该方法存在的话    
%x    以十六进制表示的整型值(基数为十六),数字a-f使用小写表示    
%X    以十六进制表示的整型值(基数为十六),数字A-F使用小写表示

PHP中文网,大量laravel教程,欢迎学习!

The above is the detailed content of What does the Golang formatting symbol %b mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn