GitSharp.Core.Util.QuotedString.BourneStyle.quote C# (CSharp) Method

quote() public method

public quote ( string instr ) : string
instr string
return string
            public override string quote(string instr)
            {
                if (instr == null)
                    throw new ArgumentNullException ("instr");
                StringBuilder r = new StringBuilder();
                r.Append('\'');
                int start = 0, i = 0;
                for (; i < instr.Length; i++) {
                    switch (instr[i]) {
                    case '\'':
                    case '!':
                        r.Append(instr, start, i - start);
                        r.Append('\'');
                        r.Append('\\');
                        r.Append(instr[i]);
                        r.Append('\'');
                        start = i + 1;
                        break;
                    }
                }

                r.Append(instr, start, i - start);
                r.Append('\'');
                return r.ToString();
            }
QuotedString.BourneStyle