using System;
namespace Jellyfin.Extensions
{
///
/// Provides extensions methods for .
///
public static class StringExtensions
{
///
/// Counts the number of occurrences of [needle] in the string.
///
/// The haystack to search in.
/// The character to search for.
/// The number of occurrences of the [needle] character.
public static int Count(this ReadOnlySpan value, char needle)
{
var count = 0;
var length = value.Length;
for (var i = 0; i < length; i++)
{
if (value[i] == needle)
{
count++;
}
}
return count;
}
}
}