C#创建的字符串(指定长度)字符串、长度

2023-09-03 16:14:18 作者:戏终人易散

有没有一种简洁的方式(即不是一个for循环)来创建一个指定长度的字符串?无所谓什么是字符串研究。

Is there a succinct way (i.e. not a for loop) to create a string of a specified length? Doesn't matter what is in the string.

推荐答案

您可以使用的字符串构造函数,一个字符 INT 。它创建了一个字符串实例与字符重复指定的次数。

You can use the string constructor that takes a char and an int. It creates a string instance with the char repeated the specified number of times.

 
精彩推荐
图片推荐