TrySplitLast
Method
TrySplitLast(ReadOnlySpan<char>, char, out ReadOnlySpan<char>, out ReadOnlySpan<char>)
public static bool TrySplitLast(this ReadOnlySpan<char> text, char splitter, out ReadOnlySpan<char> before, out ReadOnlySpan<char> after)
1. " 0 1 2" by ' ' --> " 0 1" and "2" (removes repeating split chars)
2. " 0 1 2 " by ' ' --> " 0 1 2" and "" (doesn't care about ending splitter. trim it before on your needs)
Parameters
text
ReadOnlySpan<char>
splitter
char
before
ReadOnlySpan<char>
after
ReadOnlySpan<char>
Returns
- bool
TrySplitLast(string, char, out ReadOnlySpan<char>, out ReadOnlySpan<char>)
public static bool TrySplitLast(this string text, char splitter, out ReadOnlySpan<char> before, out ReadOnlySpan<char> after)
1. " 0 1 2" by ' ' --> " 0 1" and "2" (removes repeating split chars)
2. " 0 1 2 " by ' ' --> " 0 1 2" and "" (doesn't care about ending splitter. trim it before on your needs)
Parameters
text
string
splitter
char
before
ReadOnlySpan<char>
after
ReadOnlySpan<char>
Returns
- bool