コード例 #1
0
            public static string TrimFrom(string sequence, MatchingPredicateOptions options)
            {
                var @char  = options.GetSingleChar();
                var result = sequence.Trim(@char);

                if (options.Not)
                {
                    var(f, l) = CharMatcherUtils.GetHeadAndTailLength(sequence, result);
                    return($"{@char.Repeat(f)}{@char.Repeat(l)}");
                }
                else
                {
                    return(result);
                }
            }
コード例 #2
0
            public static string TrimFrom(string sequence, MatchingPredicateOptions options)
            {
                var @string = options.GetSequenceChars();
                var result  = sequence.TrimPhrase(@string);

                if (options.Not)
                {
                    var(f, l) = CharMatcherUtils.GetHeadAndTailLength(sequence, result);
                    var f2 = (int)(f / @string.Length);
                    var l2 = (int)(l / @string.Length);
                    return($"{@string.Repeat(f2)}{@string.Repeat(l2)}");
                }
                else
                {
                    return(result);
                }
            }