Example #1
0
 public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
 {
     using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
     {
         WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters);
         return(w.ToString());
     }
 }
 public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
 {
     using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
     {
         WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters, (delimiter == '"') ? DoubleQuoteCharEscapeFlags : SingleQuoteCharEscapeFlags, StringEscapeHandling.Default);
         return(w.ToString());
     }
 }
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
        {
            int?length = StringUtils.GetLength(value);

            using (StringWriter stringWriter = StringUtils.CreateStringWriter((!length.HasValue) ? 16 : length.Value))
            {
                WriteEscapedJavaScriptString(stringWriter, value, delimiter, appendDelimiters);
                return(stringWriter.ToString());
            }
        }
Example #4
0
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
        {
            int?length = StringUtils.GetLength(value);

            using (StringWriter writer = StringUtils.CreateStringWriter(length.HasValue ? length.GetValueOrDefault() : 0x10))
            {
                WriteEscapedJavaScriptString(writer, value, delimiter, appendDelimiters);
                return(writer.ToString());
            }
        }
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters, StringEscapeHandling stringEscapeHandling)
        {
            bool[] charEscapeFlags = GetCharEscapeFlags(stringEscapeHandling, delimiter);

            using (StringWriter w = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
            {
                char[] buffer = null;
                WriteEscapedJavaScriptString(w, value, delimiter, appendDelimiters, charEscapeFlags, stringEscapeHandling, null, ref buffer);
                return(w.ToString());
            }
        }
Example #6
0
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
        {
            string result;

            using (StringWriter stringWriter = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
            {
                char[] array = null;
                JavaScriptUtils.WriteEscapedJavaScriptString(stringWriter, value, delimiter, appendDelimiters, (delimiter == '"') ? JavaScriptUtils.DoubleQuoteCharEscapeFlags : JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, ref array);
                result = stringWriter.ToString();
            }
            return(result);
        }
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters)
        {
            int?   length = StringUtils.GetLength(value);
            string result;

            using (StringWriter stringWriter = StringUtils.CreateStringWriter((!length.get_HasValue()) ? 16 : length.get_Value()))
            {
                JavaScriptUtils.WriteEscapedJavaScriptString(stringWriter, value, delimiter, appendDelimiters);
                result = stringWriter.ToString();
            }
            return(result);
        }
 public static string ToEscapedJavaScriptString(
     string value,
     char delimiter,
     bool appendDelimiters,
     StringEscapeHandling stringEscapeHandling)
 {
     bool[] charEscapeFlags = JavaScriptUtils.GetCharEscapeFlags(stringEscapeHandling, delimiter);
     using (StringWriter stringWriter = StringUtils.CreateStringWriter(StringUtils.GetLength(value) ?? 16))
     {
         char[] writeBuffer = (char[])null;
         JavaScriptUtils.WriteEscapedJavaScriptString((TextWriter)stringWriter, value, delimiter, appendDelimiters, charEscapeFlags, stringEscapeHandling, (IArrayPool <char>)null, ref writeBuffer);
         return(stringWriter.ToString());
     }
 }
        public static string ToEscapedJavaScriptString(string value, char delimiter, bool appendDelimiters, StringEscapeHandling stringEscapeHandling)
        {
            string str;

            bool[] charEscapeFlags = JavaScriptUtils.GetCharEscapeFlags(stringEscapeHandling, delimiter);
            int?   length          = StringUtils.GetLength(value);

            using (StringWriter stringWriter = StringUtils.CreateStringWriter((length.HasValue ? length.GetValueOrDefault() : 16)))
            {
                char[] chrArray = null;
                JavaScriptUtils.WriteEscapedJavaScriptString(stringWriter, value, delimiter, appendDelimiters, charEscapeFlags, stringEscapeHandling, null, ref chrArray);
                str = stringWriter.ToString();
            }
            return(str);
        }