feat: Additional validation

This commit is contained in:
Chris Cameron
2018-06-12 13:30:45 -04:00
parent 2fab5d6fd4
commit 1a931e6ffb

View File

@@ -165,6 +165,9 @@ namespace ICD.Common.Utils
[PublicAPI] [PublicAPI]
public static byte[] ToBytes(string input) public static byte[] ToBytes(string input)
{ {
if (input == null)
throw new ArgumentNullException("input");
return Encoding.GetEncoding(28591).GetBytes(input); return Encoding.GetEncoding(28591).GetBytes(input);
} }
@@ -315,6 +318,9 @@ namespace ICD.Common.Utils
/// <returns></returns> /// <returns></returns>
public static string NiceName(string name) public static string NiceName(string name)
{ {
if (name == null)
throw new ArgumentNullException("name");
Regex regex = new Regex(@" Regex regex = new Regex(@"
(?<=[A-Z])(?=[A-Z][a-z]) | (?<=[A-Z])(?=[A-Z][a-z]) |
(?<=[^A-Z])(?=[A-Z]) | (?<=[^A-Z])(?=[A-Z]) |