A
Author
I thought that this might be really simple, but I just can't figure
out how.
So, I wanna create a method that takes an int n, and the method return
n concatenated "\t"s.
i.e.,
public string GetTabs(int n)
{
if (n == 1)
{ return "\t"; }
else if (n == 2)
{ return "\t\t"; }
else if (n==3)
{ return "\t\t\t"; }
else if (n == 4)
{ return "\t\t\t\t"; }
...
...
}
I know in python, this is pretty simple, you can simple say
mystring = "\t";
myNewString = mystring * n;
And myNewString would have n "\t"s concatenated.
Is there anything similar like this in C#?
Thanks.
out how.
So, I wanna create a method that takes an int n, and the method return
n concatenated "\t"s.
i.e.,
public string GetTabs(int n)
{
if (n == 1)
{ return "\t"; }
else if (n == 2)
{ return "\t\t"; }
else if (n==3)
{ return "\t\t\t"; }
else if (n == 4)
{ return "\t\t\t\t"; }
...
...
}
I know in python, this is pretty simple, you can simple say
mystring = "\t";
myNewString = mystring * n;
And myNewString would have n "\t"s concatenated.
Is there anything similar like this in C#?
Thanks.