ソースコード
using System.Text; public static class StringExtensions { /// <summary> /// 指定された文字列を指定された回数連結して返します /// </summary> public static string Repeat( this string self, int repeatCount ) { var builder = new StringBuilder(); for ( int i = 0; i < repeatCount; i++ ) { builder.Append( self ); } return builder.ToString(); } }
使い方
Debug.Log( "★".Repeat( 3 ) ); // ★★★