mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
source code checkin
This commit is contained in:
parent
5f8fb2c825
commit
7e57b72e35
675 changed files with 168433 additions and 0 deletions
38
src/NeXtVdf/StringRepeatUtils.cs
Normal file
38
src/NeXtVdf/StringRepeatUtils.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System.Text;
|
||||
|
||||
namespace NeXt.Vdf
|
||||
{
|
||||
static class StringRepeatUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Repeats a string i times
|
||||
/// </summary>
|
||||
/// <param name="self"></param>
|
||||
/// <param name="i"></param>
|
||||
/// <returns></returns>
|
||||
public static string Repeat(this string self, int i)
|
||||
{
|
||||
if(i < 1)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else if(i < 2)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
else if(i < 3)
|
||||
{
|
||||
return self + self;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int x = 0; x < i ; x++)
|
||||
{
|
||||
sb.Append(self);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue