コード例 #1
0
 public static string ToString(string value, char delimiter, StringEscapeHandling stringEscapeHandling)
 {
     if (delimiter != '\"' && delimiter != '\'')
     {
         throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
     }
     return(JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, true, stringEscapeHandling));
 }
コード例 #2
0
        /// <summary>Converts the <see cref="String"/> to its JSON string representation.</summary>
        /// <param name="value">The value to convert.</param>
        /// <param name="delimiter">The string delimiter character.</param>
        /// <param name="stringEscapeHandling">The string escape handling.</param>
        /// <returns>A JSON string representation of the <see cref="String"/>.</returns>
        public static string ToString(string value, char delimiter, StringEscapeHandling stringEscapeHandling)
        {
            if (delimiter != '"' && delimiter != '\'')
            {
                ThrowHelper.ThrowArgumentException(ExceptionResource.Json_Delimiter_Err, ExceptionArgument.delimiter);
            }

            return(JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, true, stringEscapeHandling));
        }
コード例 #3
0
 /// <summary>
 /// Writes a <see cref="String"/> value.
 /// </summary>
 /// <param name="value">The <see cref="String"/> value to write.</param>
 public override void WriteValue(string value)
 {
     base.WriteValue(value);
     if (value == null)
     {
         WriteValueInternal(JsonConvert.Null, JsonToken.Null);
     }
     else
     {
         string escapedValue = JavaScriptUtils.ToEscapedJavaScriptString(value, _quoteChar, true);
         _writer.Write((Formatting == Formatting.Html ? $"<div class=\"form-control iio-value flex\">{escapedValue}</div>" : escapedValue));
     }
 }
コード例 #4
0
 /// <summary>
 /// Converts the <see cref="String"/> to its JSON string representation.
 /// </summary>
 /// <param name="value">The value to convert.</param>
 /// <param name="delimter">The string delimiter character.</param>
 /// <returns>A JSON string representation of the <see cref="String"/>.</returns>
 public static string ToString(string value, char delimter)
 {
     return(JavaScriptUtils.ToEscapedJavaScriptString(value, delimter, true));
 }