BF2Statistics.StringExtensions.Repeat C# (CSharp) Method

Repeat() public static method

Repeats the current string the number of times specified
public static Repeat ( this input, int count = 1, string delimiter = "" ) : string
input this The string that is being repeated
count int The number of times to repeat this string
delimiter string The sequence of one or more characters used to specify the boundary between repeats
return string
        public static string Repeat(this string input, int count = 1, string delimiter = "")
        {
            // Make sure we arent null!
            if (input == null || count == 0)
                return input;

            // Create a new string builder
            StringBuilder builder = new StringBuilder(input.Length + ((input.Length + delimiter.Length) * count));

            // Do repeats
            builder.Append(input);
            for (int i = 0; i < count; i++)
                builder.Append(delimiter + input);

            return builder.ToString();
        }