Merge pull request #5276 from Bond-009/minor12
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
#pragma warning disable CA1062 // Validate arguments of public methods
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace MediaBrowser.Common.Net
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user