Example #1
0
        public static string MakeTitleCase(string s, TextInfo textInfo)
        {
#if DEBUG
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }
            if (textInfo == null)
            {
                throw new ArgumentNullException(nameof(textInfo));
            }
#endif

            if (s.Length == 0)
            {
                return(s);
            }

            var builder = StringBuilderPool.Get(textInfo.ToLower(s));
            builder[0] = textInfo.ToUpper(s[0]);
            return(StringBuilderPool.GetStringAndReturn(builder));
        }
Example #2
0
        public static string RemoveChars(this string @this, CharacterSet chars)
        {
#if DEBUG
            if (@this == null)
            {
                throw new ArgumentNullException(nameof(@this));
            }
            if (chars == null)
            {
                throw new ArgumentNullException(nameof(chars));
            }
#endif

            if (@this.Length == 0 || chars.IsEmpty)
            {
                return(@this);
            }

            var builder = StringBuilderPool.Get(@this);
            builder.RemoveChars(chars);
            return(StringBuilderPool.GetStringAndReturn(builder));
        }