mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +00:00
refactor: Adding validation to StringUtils.Repeat
This commit is contained in:
@@ -423,7 +423,12 @@ namespace ICD.Common.Utils
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string Repeat(string input, int count)
|
public static string Repeat(string input, int count)
|
||||||
{
|
{
|
||||||
return count == 0 ? string.Empty : new StringBuilder().Insert(0, input, count).ToString();
|
if (count < 0)
|
||||||
|
throw new ArgumentOutOfRangeException("count");
|
||||||
|
|
||||||
|
return input == null || count == 0
|
||||||
|
? string.Empty
|
||||||
|
: new StringBuilder().Insert(0, input, count).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user