|
C#重复生成字符串函数(Repeat)
作者:C/S框架网|www.csframewo 发布日期:2023/09/18 15:51:06
C#重复生成字符串函数(Repeat)扩展方法: C# Code: /// <summary> /// C#重复生成字符串函数 /// </summary> /// <param name="strToRepeat">字符串,如:a</param> /// <param name="repeat">重复次数</param> /// <returns></returns> public static string Repeat(this string strToRepeat, int repeat) { return string.Concat(Enumerable.Repeat(strToRepeat, repeat)); }
测试:
C# Code: var str = "a"; str = str.Repeat(10);//aaaaaaaaaa
//来源:C/S框架网 | www.csframework.com | QQ:23404761 扫一扫加作者微信
|
旗舰版V5.1
(作者推荐)
轻量框架V2.1
(2021 release)
|
< img id="bigimg" style="border:5px solid #fff;" src="" />