What about this:
string tabs = new string('\t', n);
Where n
is the number of times you want to repeat the string.
Or better:
static string Tabs(int n)
{
return new string('\t', n);
}
More Related Contents:
- Most efficient way to concatenate strings?
- How to convert UTF-8 byte[] to string
- How can I String.Format a TimeSpan object with a custom format in .NET?
- Convert String to Type in C# [duplicate]
- How do I split a string by a multi-character delimiter in C#?
- When is it better to use String.Format vs string concatenation?
- Way to have String.Replace only hit “whole words”
- Best way to resolve file path too long exception
- Splitting a string / number every Nth Character / Number?
- Is String.Contains() faster than String.IndexOf()?
- Is there an alternative to string.Replace that is case-insensitive?
- Escape curly brace ‘{‘ in String.Format [duplicate]
- Why is there no Char.Empty like String.Empty?
- How do I split a string by strings and include the delimiters using .NET?
- How do I truncate a .NET string?
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- Is String a primitive type?
- string.IsNullOrEmpty(string) vs. string.IsNullOrWhiteSpace(string)
- If strings are immutable in .NET, then why does Substring take O(n) time?
- string.ToLower() and string.ToLowerInvariant()
- C# Version Of SQL LIKE
- What is the correct way to compare char ignoring case?
- Compare string similarity
- How to convert string to integer in C#
- Regex nested parentheses
- string.Empty vs null.Which one do you use?
- How to use StringBuilder wisely?
- Format Strings in Console.WriteLine method
- splitting a string based on multiple char delimiters
- what’s the use of string.Clone()?