DansTonCode.net
quote.smartness() == 42In the one and only true way. The object-oriented version of 'Spaghetti code' is, of course, 'Lasagna code'. (Too many layers).@author Roberto Waltman
Quote #296
csharp
@
author 
Anonymous
0
        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);
        }
Code-source en csharp proposé par Anonymous
 
 0