diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-02-21 02:49:52 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-02-21 02:49:52 +0100 |
| commit | eba859e33e7bf611e5b4d63acd4df81038154be8 (patch) | |
| tree | f8ea283812f2efae1e807493f3a59646d7430df5 /MediaBrowser.Common/Extensions/StringExtensions.cs | |
| parent | 13d65318eb36f3fc423d8060e0092c8671579ed0 (diff) | |
Minor improvements
Diffstat (limited to 'MediaBrowser.Common/Extensions/StringExtensions.cs')
| -rw-r--r-- | MediaBrowser.Common/Extensions/StringExtensions.cs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/MediaBrowser.Common/Extensions/StringExtensions.cs b/MediaBrowser.Common/Extensions/StringExtensions.cs deleted file mode 100644 index 764301741..000000000 --- a/MediaBrowser.Common/Extensions/StringExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -#nullable enable - -using System; - -namespace MediaBrowser.Common.Extensions -{ - /// <summary> - /// Extensions methods to simplify string operations. - /// </summary> - public static class StringExtensions - { - /// <summary> - /// Returns the part on the left of the <c>needle</c>. - /// </summary> - /// <param name="haystack">The string to seek.</param> - /// <param name="needle">The needle to find.</param> - /// <returns>The part left of the <paramref name="needle" />.</returns> - public static ReadOnlySpan<char> LeftPart(this ReadOnlySpan<char> haystack, char needle) - { - var pos = haystack.IndexOf(needle); - return pos == -1 ? haystack : haystack[..pos]; - } - - /// <summary> - /// Returns the part on the left of the <c>needle</c>. - /// </summary> - /// <param name="haystack">The string to seek.</param> - /// <param name="needle">The needle to find.</param> - /// <param name="stringComparison">One of the enumeration values that specifies the rules for the search.</param> - /// <returns>The part left of the <c>needle</c>.</returns> - public static ReadOnlySpan<char> LeftPart(this ReadOnlySpan<char> haystack, ReadOnlySpan<char> needle, StringComparison stringComparison = default) - { - var pos = haystack.IndexOf(needle, stringComparison); - return pos == -1 ? haystack : haystack[..pos]; - } - } -} |
