Common placeholder meanings in golang %s %d %c

%b A binary integer, convert an integer format into a binary expression
%c a Unicode character
%d decimal integer
%o octal integer
%x lowercase hexadecimal value
%X uppercase hexadecimal value
%U An integer code value expressed in Unicode notation
%s outputs characters expressed in native UTF8 bytes, if the console does not support utf8 encoding, it will be garbled
%t outputs a boolean value as true or false
%v outputs the value using the default format, or if the method exists, uses the String() method of the class value to output a custom value
%T type of output value

%p output pointer address hexadecimal representation, prefix 0x Printf(“%p”, &people) output 0x4f57f0

Leave a Reply

Your email address will not be published. Required fields are marked *