diff --git a/ICD.Common.Utils/Extensions/UriExtensions.cs b/ICD.Common.Utils/Extensions/UriExtensions.cs index 976b1dd..503f295 100644 --- a/ICD.Common.Utils/Extensions/UriExtensions.cs +++ b/ICD.Common.Utils/Extensions/UriExtensions.cs @@ -46,5 +46,21 @@ namespace ICD.Common.Utils.Extensions return extends.ToString() == "http://localhost/"; } + + /// + /// Returns the string representation of the given URI, replacing the password with asterixes. + /// + /// + /// + public static string ToPrivateString([NotNull] this Uri extends) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + IcdUriBuilder builder = new IcdUriBuilder(extends); + builder.Password = builder.Password == null ? null : StringUtils.PasswordFormat(builder.Password); + + return builder.ToString(); + } } }