| 1 | // Copyright 2016 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 currency_testscip-go gomod golang.org/x/text . `golang.org/x/text/currency_test`/ |
| 6 | |
| 7 | import ( |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 9 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 10 | |
| 11 | "golang.org/x/text/currencyscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/" |
| 12 | ) |
| 13 | |
| 14 | func ExampleQueryscip-go gomod golang.org/x/text . `golang.org/x/text/currency_test`/ExampleQuery().() { |
| 15 | t1799, _ := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Parsescip-go gomod github.com/golang/go/src go1.25.0 time/Parse().("2006-01-02", "1799-01-01") |
| 16 | for it := currencyscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/.Queryscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/Query().(currencyscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/.Datescip-go gomod golang.org/x/text . `golang.org/x/text/currency`/Date().(t1799)); it.Nextscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/QueryIter#Next.(); { |
| 17 | from := "" |
| 18 | if t, ok := it.Fromscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/QueryIter#From.(); ok { |
| 19 | from = t.Formatscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Format().("2006-01-02") |
| 20 | } |
| 21 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Printfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Printf().("%v is used in %v since: %v\n", it.Unitscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/QueryIter#Unit.(), it.Regionscip-go gomod golang.org/x/text . `golang.org/x/text/currency`/QueryIter#Region.(), from) |
| 22 | } |
| 23 | // Output: |
| 24 | // GBP is used in GB since: 1694-07-27 |
| 25 | // GIP is used in GI since: 1713-01-01 |
| 26 | // USD is used in US since: 1792-01-01 |
| 27 | } |