using System.Text; namespace Terminal.Gui { /// /// Extension helper of to work with specific text manipulation./> /// public static class StringExtensions { /// /// Repeats the times. /// /// The text to repeat. /// Number of times to repeat the text. /// /// The text repeated if is greater than zero, /// otherwise . /// public static string Repeat (this string instr, int n) { if (n <= 0) { return null; } if (string.IsNullOrEmpty (instr) || n == 1) { return instr; } return new StringBuilder (instr.Length * n) .Insert (0, instr, n) .ToString (); } } }