Example #1
0
        public static ReadOnlyMemory <char> LastRightPart(this ReadOnlyMemory <char> strVal, string needle)
        {
            if (strVal.IsEmpty)
            {
                return(strVal);
            }
            var pos = strVal.LastIndexOf(needle);

            return(pos == -1
                ? strVal
                : strVal.Slice(pos + needle.Length));
        }
Example #2
0
        public static ReadOnlyMemory <char> LastLeftPart(this ReadOnlyMemory <char> strVal, char needle)
        {
            if (strVal.IsEmpty)
            {
                return(strVal);
            }
            var pos = strVal.LastIndexOf(needle);

            return(pos == -1
                ? strVal
                : strVal.Slice(0, pos));
        }