diff --git a/ICD.Common.Utils.Tests/StringUtilsTest.cs b/ICD.Common.Utils.Tests/StringUtilsTest.cs
index 3e75cb3..c30931e 100644
--- a/ICD.Common.Utils.Tests/StringUtilsTest.cs
+++ b/ICD.Common.Utils.Tests/StringUtilsTest.cs
@@ -178,5 +178,12 @@ namespace ICD.Common.Utils.Tests
{
Assert.AreEqual(expected, StringUtils.Enquote(input));
}
+
+ [TestCase("\"test\"", "test")]
+ [TestCase("\"test test\"", "test test")]
+ public void UnEnquoteTest(string input, string expected)
+ {
+ Assert.AreEqual(expected, StringUtils.UnEnquote(input));
+ }
}
}
diff --git a/ICD.Common.Utils/StringUtils.cs b/ICD.Common.Utils/StringUtils.cs
index 51af75b..de9815f 100644
--- a/ICD.Common.Utils/StringUtils.cs
+++ b/ICD.Common.Utils/StringUtils.cs
@@ -707,5 +707,21 @@ namespace ICD.Common.Utils
return value;
}
+
+ ///
+ /// Removes the start and trailing double quote from the string if BOTH are present.
+ ///
+ ///
+ ///
+ public static string UnEnquote(string value)
+ {
+ if (value == null)
+ throw new ArgumentNullException("value");
+
+ if (value.StartsWith('"') && value.EndsWith('"'))
+ return value.Substring(1, value.Length - 2);
+
+ return value;
+ }
}
}