mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
printf: 0x not shown anymore in front of 0 while in alternative mode
This commit is contained in:
parent
3b884966ac
commit
0648321d97
1 changed files with 10 additions and 2 deletions
|
@ -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}")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue