diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index 957c471..89b8d8a 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -178,6 +178,7 @@ + diff --git a/ICD.Common.Utils/UriUtils.cs b/ICD.Common.Utils/UriUtils.cs new file mode 100644 index 0000000..aec717d --- /dev/null +++ b/ICD.Common.Utils/UriUtils.cs @@ -0,0 +1,31 @@ +using System; + +namespace ICD.Common.Utils +{ + public static class UriUtils + { + /// + /// Attempts to parse the given URI string into a System.Uri instance. + /// + /// + /// + /// + public static bool TryParse(string uri, out Uri output) + { + output = null; + + if (string.IsNullOrEmpty(uri)) + return false; + + try + { + output = new Uri(uri); + return true; + } + catch (UriFormatException) + { + return false; + } + } + } +}