Meta.StringExtensions.Quote C# (CSharp) Method

Quote() public static method

public static Quote ( this s ) : string
s this
return string
        public static string Quote(this string s)
        {
            Regex doubleQuotedString = new Regex("\"[^\\\"]*(\\.[^\\\"]*)*\"");
            if( !doubleQuotedString.IsMatch(s) )
            {
                string quote = "\"";
                return quote + s + quote;
            }

            return s;
        }