Exemplo n.º 1
0
        public static string EnsureEndsWith(this string value, string suffix, StringEnsureOptions options)
        {
            if (options == StringEnsureOptions.IgnoreNullOrEmpty && string.IsNullOrEmpty(value))
                return value;

            if (value.EndsWith(suffix))
                return value;

            return value + suffix;
        }
Exemplo n.º 2
0
        public static string EnsureStartsWith(this string value, string prefix, StringEnsureOptions options)
        {
            if (options == StringEnsureOptions.IgnoreNullOrEmpty && string.IsNullOrEmpty(value))
                return value;

            if (value.StartsWith(prefix))
                return value;

            return prefix + value;
        }