This project has moved and is read-only. For the latest updates, please go here.

Paste like intellij

Mar 26, 2012 at 10:31 PM

I modified the StringinizeInCs method to this.... (this acts like intellij where it will escape multiple lines - think copying multi-line sql query)

 

 

        private static string StringinizeInCs(string txt)
        {
            //c# quote character -- really just a "
            const string qChr = "\"";

            //sb to work with
            var sb = new StringBuilder(txt);

            //escape appropriately
            //escape the quotes with ""
            sb.Replace(qChr, "\\\"");
            sb.Replace("\r\n", "\\r\\n \" + " + Environment.NewLine + " \"");
            //insert " at beginning and end
            return sb.ToString();
        }