mirror of
https://github.com/golang/go
synced 2024-11-20 02:54:39 -07:00
fmt: allow %U for unsigned integers.
Suggested by jan.mercl@nic.cz. R=rsc, jnml CC=golang-dev https://golang.org/cl/4376054
This commit is contained in:
parent
11e07d23ed
commit
4fe9f57413
@ -170,6 +170,7 @@ var fmttests = []struct {
|
|||||||
|
|
||||||
// unicode format
|
// unicode format
|
||||||
{"%U", 0x1, "U+0001"},
|
{"%U", 0x1, "U+0001"},
|
||||||
|
{"%U", uint(0x1), "U+0001"},
|
||||||
{"%.8U", 0x2, "U+00000002"},
|
{"%.8U", 0x2, "U+00000002"},
|
||||||
{"%U", 0x1234, "U+1234"},
|
{"%U", 0x1234, "U+1234"},
|
||||||
{"%U", 0x12345, "U+12345"},
|
{"%U", 0x12345, "U+12345"},
|
||||||
|
@ -389,6 +389,8 @@ func (p *pp) fmtUint64(v uint64, verb int, goSyntax bool, value interface{}) {
|
|||||||
p.fmt.integer(int64(v), 16, unsigned, ldigits)
|
p.fmt.integer(int64(v), 16, unsigned, ldigits)
|
||||||
case 'X':
|
case 'X':
|
||||||
p.fmt.integer(int64(v), 16, unsigned, udigits)
|
p.fmt.integer(int64(v), 16, unsigned, udigits)
|
||||||
|
case 'U':
|
||||||
|
p.fmtUnicode(int64(v))
|
||||||
default:
|
default:
|
||||||
p.badVerb(verb, value)
|
p.badVerb(verb, value)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user