Is there any simple method to concatenate '0' before an int variable.
Like:
int i = 2;
// produce
i = someMethod(i);
// output:
i = 02
Is there any simple method to concatenate '0' before an int variable.
Like:
int i = 2;
// produce
i = someMethod(i);
// output:
i = 02
If you mean "concatenate", then you can define someMethod() as follows:
string someMethod(int i){
return string.Format("{0:d2}", i);
}
The "2" in the string format defines the number of characters in the output.