c# - padding in asp.net -


is there function append padding digits left of digit.i want form 3 digit number, when value '3' need make '003'

e.g in php have

$m_ccode=str_pad($m_casecode,3,"0",str_pad_left); 

same want convert in asp.net c#. how can it, have numeric value stored in string 's'

string s = dropdownlist3.selecteditem.value; 

string variant1 = "3".padleft(3, '0'); // if have string string variant2 = 3.tostring("000"); // if have number 

in case need unbox int if numeric value int

string s = ((int)dropdownlist3.selecteditem.value).tostring("000"); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -