In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use the Go fmt package". The content in the article is simple and clear, easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use the Go fmt package".
1. The default format for the common placeholder% v value. % + v is similar to% v, but the Go syntax of the field name% # v corresponding value is added to the output structure. the Go syntax of the type of T corresponding value represents%% sign, literal%, non-placeholder meaning.
Under the default format% v, the underlying layer will call the default format for different data types:
Bool:% t int, int8 etc.:% d uint, uint8 etc.:% d,% x if printed with% # vfloat32, complex64, etc:% gstring:% schan:% p pointer:% p
If it is a complex object, print according to the following rules:
Struct: {field0 field1...} array, slice: [elem0 elem1...] Maps: map [key1:value1 key2:value2] pointer to above: & {}, & map [] Integer Type:% b binary represents% c the character represented by the corresponding Unicode code point% d decimal represents% o octal represents the literal value of the character surrounded by% Q single quotation marks, safely escaped% x hexadecimal by Go syntax The letter form is lowercase Amurf% X hexadecimal representation, and the letter form is uppercase Amurf% U Unicode format: 123. it is equivalent to the scientific counting of floating point% b without decimal part and binary index, such as-123456p-78. See strconv.FormatFloat% e scientific counting method, such as-1234.456e+78% E scientific counting method, such as-1234.456E+78% f has fractional part but no exponential part, such as 123.456 F is equivalent to% f% g using% e or% f format (for more concise and accurate output)% e scientific counting method according to the actual situation For example-1234.456e+78% E scientific counting, for example-1234.456E+78% f has a decimal point but no index, for example 123.456 g choose% e or% f as appropriate to produce a more compact (no ending 0) output% G choose% E or% f to produce a more compact (no ending 0) output Boolean% true or false thank you for your reading The above is the content of "how to use Go fmt package". After the study of this article, I believe you have a deeper understanding of how to use Go fmt package, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.