P2PStateServer.ServiceMessage.Unquote C# (CSharp) Method

Unquote() protected method

Removes quotes from a string if the string is surrounded by quotes
protected Unquote ( string value ) : string
value string Quoted/Unquoted string
return string
        protected string Unquote(string value)
        {
            if (value == null) throw new ArgumentNullException("value");

            value = value.Trim();

            if (value.StartsWith("\"") && value.EndsWith("\""))
            {
                if (value.Length == 2) return string.Empty;
                return value.Substring(1, value.Length - 2); //remove quotes
            }

            return value;
        }