示例#1
0
        /// <summary>
        /// Dequote
        /// </summary>
        public static string Dequote(this IQuotation rule, string value)
        {
            if (rule is null)
            {
                throw new ArgumentNullException(nameof(rule));
            }
            if (value is null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            if (rule.TryDequote(value, out string result))
            {
                return(result);
            }

            throw new FormatException("Failed to return quoatation.");
        }
示例#2
0
        /// <summary>
        /// Try Dequote
        /// </summary>
        /// <param name="source">String to Dequote</param>
        /// <param name="result">Dequoted string or null</param>
        /// <param name="rule">Rule to use</param>
        /// <returns>true if dequoted, false otherwise</returns>
        public static bool TryDequote(this string source, out string result, IQuotation rule)
        {
            rule ??= Quotation.Default;

            return(rule.TryDequote(source, out result));
        }