Citation de code source en C#n° 269
4 June 2016 à 01:30
public string PrependZeroes(int stringLength, string str)
{
var sb = new StringBuilder();
for (var ix = 0; ix < stringLength; ix++)
{
sb.Append("0");
}
sb.Append(str);
var startIx = sb.Length - stringLength;
if (startIx < 0)
startIx = 0;
return sb.ToString().Substring(startIx, stringLength);
}