Top "Zero-pad" questions

How can I pad an integer with zeros on the left?

How do you left pad an int with zeros when converting to a String in java? I'm basically looking to …

java formatting zero-pad
Zero-pad digits in string

I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly …

php zero-pad
Python datetime formatting without zero-padding

Is there a format for printing Python datetimes that won't use zero-padding on dates and times? Format I'm using now: …

python datetime formatting zero-pad
Zero pad numpy array

What's the more pythonic way to pad an array with zeros at the end? def pad(A, length): ... A = np.…

python numpy numpy-ndarray zero-pad zero-padding
Java convert any integer to 4 digits

This seems like an easy question. One of my assignments basically sends a time in military format (like 1200, 2200, etc) to …

java integer format zero-pad
C# Padding Amount With Zeros

I have an amount field which is a decimal in the database. I need to always display this amount with 10 …

c# decimal zero zero-pad
Formatting a date in R without leading zeros

Is there a way to use the format function on a date object, specifically an object of class POSIXlt, POSIXct, …

r date zero-pad
In PHP, how do I add to a zero-padded numeric string and preserve the zero padding?

If I have a variable in PHP containing 0001 and I add 1 to it, the result is 2 instead of 0002. How do …

php variables string-formatting zero-pad
Simple and elegant way to zero-pad a value in C#

I have to fix malformed zipcodes. The people who exported the data treated the zipcode as a numeric and as …

c# zero-pad