예제 #1
0
        /// <summary>
        /// Try Unescape
        /// </summary>
        public static bool TryUnescape(this string value, out string result, IEscaper escaper)
        {
            if (escaper is null)
            {
                throw new ArgumentNullException(nameof(escaper));
            }

            return(escaper.TryUnescape(value, out result));
        }
예제 #2
0
        /// <summary>
        /// Unescape
        /// </summary>
        public static string Unescape(this IEscaper rules, string value)
        {
            if (rules is null)
            {
                throw new ArgumentNullException(nameof(rules));
            }

            if (rules.TryUnescape(value, out string result))
            {
                return(result);
            }

            throw new FormatException("String is not properly escaped.");
        }