pad - How padding 2 variable on c#? -
this question has answer here:
- add zero-padding string 4 answers
function zeropad(num, places){ var 0 = places - num.tostring().length + 1; return array(+(zero > 0 && zero)).join("0") + num; }
please tell me means of code above, , how use on c#
the code javascript , pads number num
zeros length places
, example zeropad(12, 4)
gives 0012
. in c# can padleft()
method, example 12.tostring().padleft(4, '0')
gives same above 0012
.
Comments
Post a Comment