diff --git a/ICD.Common.Utils/Extensions/StringExtensions.cs b/ICD.Common.Utils/Extensions/StringExtensions.cs
index 0e263f3..b82d1d7 100644
--- a/ICD.Common.Utils/Extensions/StringExtensions.cs
+++ b/ICD.Common.Utils/Extensions/StringExtensions.cs
@@ -157,6 +157,21 @@ namespace ICD.Common.Utils.Extensions
return new string(extends.Where(c => !char.IsWhiteSpace(c)).ToArray());
}
+ ///
+ /// Replaces spans of whitespace with a single space.
+ ///
+ ///
+ ///
+ [PublicAPI]
+ [NotNull]
+ public static string RemoveDuplicateWhitespace([NotNull] this string extends)
+ {
+ if (extends == null)
+ throw new ArgumentNullException("extends");
+
+ return Regex.Replace(extends, @"\s+", " ");
+ }
+
///
/// Removes all occurrences of the given string.
///
diff --git a/ICD.Common.Utils/StringUtils.cs b/ICD.Common.Utils/StringUtils.cs
index 43d7533..6ffd051 100644
--- a/ICD.Common.Utils/StringUtils.cs
+++ b/ICD.Common.Utils/StringUtils.cs
@@ -647,6 +647,16 @@ namespace ICD.Common.Utils
return text == null ? null : text.RemoveWhitespace();
}
+ ///
+ /// Replaces spans of whitespace with a single space.
+ ///
+ ///
+ ///
+ public static string RemoveDuplicateWhitespace(string text)
+ {
+ return text == null ? null : text.RemoveDuplicateWhitespace();
+ }
+
///
/// Returns true if the string is entirely whitespace characters, or empty, or null.
///