#How do i make integer formatting not put the + number sign?

1 messages · Page 1 of 1 (latest)

sturdy tiger
#

Whenever i try to format an integer, it always puts the sign, even though i do not want it, is it possible to have it not put the + sign?

heady monolith
sturdy tiger
#

is there no better way to make it Not do that?

twilit shale
#

count could be an []u32 or whatever.

But I agree that format behavior is annoying.

sturdy tiger
#

im reading a file format which itself uses negative numbers to convey information, but its never displayed

heady monolith
#

If you give it a really short name like n4 or something, it wouldn't be too much more to type:

std.debug.print("{}\n", .{n4(some_number)});
sturdy tiger
#

i'll probably just do the cast and open an issue to make this behaviour configurable somehow, its very unexpected for when i pad by 0s for it to randomly toss a + in the middle for the sign

heady monolith
#

Yeah, I agree, hopefully a future version of std.fmt can accept something like a sign or variant option as supported in some other similar formatting libraries