mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
printf: 0x not shown anymore in front of 0 while in alternative mode
This commit is contained in:
committed by
Terts Diepraam
parent
3b884966ac
commit
0648321d97
@@ -156,13 +156,21 @@ impl Formatter for UnsignedInt {
|
||||
format!("{x:x}")
|
||||
}
|
||||
UnsignedIntVariant::Hexadecimal(Case::Lowercase, Prefix::Yes) => {
|
||||
format!("{x:#x}")
|
||||
if x == 0 {
|
||||
"0".to_string()
|
||||
} else {
|
||||
format!("{x:#x}")
|
||||
}
|
||||
}
|
||||
UnsignedIntVariant::Hexadecimal(Case::Uppercase, Prefix::No) => {
|
||||
format!("{x:X}")
|
||||
}
|
||||
UnsignedIntVariant::Hexadecimal(Case::Uppercase, Prefix::Yes) => {
|
||||
format!("{x:#X}")
|
||||
if x == 0 {
|
||||
"0".to_string()
|
||||
} else {
|
||||
format!("{x:#X}")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user