| 1 |
// Copyright 2017 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Package number formats numbers according to the customs of different locales. |
| 6 |
// |
| 7 |
// The number formats of this package allow for greater formatting flexibility |
| 8 |
// than passing values to message.Printf calls as is. It currently supports the |
| 9 |
// builtin Go types and anything that implements the Convert interface |
| 10 |
// (currently internal). |
| 11 |
// |
| 12 |
// p := message.NewPrinter(language.English) |
| 13 |
// |
| 14 |
// p.Printf("%v bottles of beer on the wall.\n", number.Decimal(1234)) |
| 15 |
// // Prints: 1,234 bottles of beer on the wall. |
| 16 |
// |
| 17 |
// p.Printf("%v of gophers lose too much fur.\n", number.Percent(0.12)) |
| 18 |
// // Prints: 12% of gophers lose too much fur. |
| 19 |
// |
| 20 |
// p = message.NewPrinter(language.Dutch) |
| 21 |
// p.Printf("There are %v bikes per household.\n", number.Decimal(1.2)) |
| 22 |
// // Prints: There are 1,2 bikes per household. |
| 23 |
// |
| 24 |
// The width and scale specified in the formatting directives override the |
| 25 |
// configuration of the formatter. |
| 26 |
package number |