Go Standard Library Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

The code example shows the most commonly used options for integers and floating-point numbers.

The formatting in Go is derived from C's  printf  function . The so-called   verbs  are used to define the formatting of a number. The verb, for example, could be %X, which in fact is a placeholder for the value.

Besides the basic formatting, there are also rules in formatting that are related to the local manners. With formatting, according to the locale, the package golang.org/x/text/message could help. See the second code example in this recipe. This way, it is possible to localize the number formatting.