[英]How can I repeat a character to make up a string if I have a number for the times to repeat?
我有以下代碼:
vm.Points = phrase.Points.ToString();
我想用一個放置X字符的次數替換它,該次數要是存在短語.Points的次數,而短語.Points是整數。
因此,如果phrase.Points的值為5,那么我希望vm.Points的值為“ XXXXX”
您正在尋找這個:
new String('X', phrase.Points);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.