I want easy function like that:
string getStringWithCharAndLength(char ch, int l)
{
//Some easy code
//return ch+ch+...+ch(string with Length l)
}
Example:
string str = getStringWithCharAndLength('k',5);<br>
Console.WriteLine(str);// "kkkkk"
Note: not this kind of solution:
string getStringWithCharAndLength(char ch, int l)
{
string str="";
for(int i=0;i<l;i++)
str+=ch;
return str;
}
It's trivial - there's a string constructor that does it already:
string text = new string('z', 5); // "zzzzz"
See more on this question at Stackoverflow