copy a character with specific length

前端 未结 1 1402
北海茫月
北海茫月 2021-01-22 15:54

How can I fill a string with a specific character like make string and length like (y,4) and the result is yyyy I know there is something like in c++, fillstring Is that exist

1条回答
  •  庸人自扰
    2021-01-22 16:26

    Just use the appropriate constructor:

    string text = new string('y', 4);
    

    0 讨论(0)
提交回复
热议问题