public static string quote(string @string){java.lang.StringBuilder sb = new java.lang.StringBuilder();sb.append("\\Q");int apos = 0;int k;while ((k = @string.IndexOf("\\E", apos)) >= 0){sb.append(Sharpen.StringHelper.Substring(@string, apos, k + 2)).append("\\\\E\\Q");apos = k + 2;}return sb.append(Sharpen.StringHelper.Substring(@string, apos)).append("\\E").ToString();}