In C#, as inputs i have:
Letter: "A"
Length: 5
and i want to output:
"AAAAA"
Is there a more elegant way of doing this besides loop?
你可以使用字符串构造函数: new string('A', 5);
你可以只是重复String构造函数的字符来创建String。
Console.WriteLine(new String('A', 5));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.